Re: F# fsharp
Brandon Van Every <[email protected]>
| Newsgroups | gmane.games.devel.sweng |
|---|---|
| Message-ID | <[email protected]> |
On Sat, May 29, 2010 at 10:36 AM, Douglas Cox <[email protected]> wrote: > Brandon, > >For example, what were you looking for in an interpreter? Scalability with respect to compilation. If I write some code and run it through an interpreter, and it turns out to be slow enough that I notice a problem, then as a first pass optimization, I'd like to change it into compiled code. I suppose this can be accomplished easily enough with F#, C# + Mono, or Lua .NET. I don't know if the performance gains are sufficient for Lua .NET, I haven't looked that up. The scalability is not easy to accomplish when using an interpreted language and native C++. One has to do a lot of work converting between languages. This may not be as much of a problem with respect to Squirrel; I know that it interfaces to C++ better than Lua, but I don't know about translating to C++. Maturity of support. F# ships with an interpreter out of the box in VS10, although I would expect the usual "first MS product" pitfalls. IronPython does not have that same level of support, that's why it's not included in VS10. I don't really know about Lua .NET. Squirrel is a new kid on the block with a small support team. Ease of interop at the language boundary. If you're using only 1 language, there's a lot less to worry about, crossing from compiled to interpreted code. Speed of builds. Editing code on the fly and not having to wait for a build is a boost to developer productivity. In native C++ development, changing header files definitely triggers recompliation, sometimes tons of recompilation. Changing a single source file may or may not be noticeable. Link times can definitely be noticeable, depending on how the app is structured. Semantic expressiveness. F# beats C# here, even if both are scalable with respect to compilation. If you ignore the "expert level" aspects of F#, it actually looks like a scripting language, with syntactical support for higher level constructs such as lists and pattern matching. C# does not. C# looks like Java. Metaprogramming. This is a core strength of functional programming languages; really, what does C# have to say here? Lua probably does an ok job of this in its own way, but if I wanted to implement general purpose DSLs, code translators, or dynamically generated code, F# is the more powerful toolbox. I will be using these capabilities for procedural / dynamic content generation. > And what are you looking for F# to provide you? For bonus points, I'll say that I'd like to dump C++ for good. As the years go on, my objection to garbage collection gets less and less. I first learned C++ 17 years ago. That's a long time, and it shows in the language design. C++ has accumulated tons of higher level cruft to get things done, that are exceedingly expert oriented. I haven't kept up with that and I haven't wanted to. I've coded C++ defensively and simplistically, to stay sane. The only developers who have an advantage using C++, are those who have been coding it for so many years, and who have swallowed so much cruft already, that it is second nature to them. They tend to say things like "all we need is more programmer education" as to what's wrong with C++. Of course they say that, because they don't need any education, they've already swallowed it all! Unfortunately, um, in the meantime Java and C# are pretty dumbed down languages. I've never been interested, and they've never become interesting. Partly because I just don't care about the web, or about mobile devices. The former, because of my 3D ASM biases, has always been too slow. The latter, have screens that are too tiny. They're both an opportunity to do all the games that have been done to death forever. So, several years ago I started up the functional programming learning curve. Unfortunately it, aaah, required a lot of programmer education too. As an ASM guy it often left me scratching my head and not caring. I put it down for awhile. Now MS has finally shipped a commercially viable functional programming language. F# potentially has dollar signs written on it, whereas previously everything was just R&D academic stuff, with a few narrow exceptions in some corners of the computer industry. It's much easier to justify a learning curve now, and I'd rather put it into new stuff (FP) than old stuff (C++). Cheers, Brandon Van Every _______________________________________________ Sweng-Gamedev mailing list [email protected] http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com