Hacker News new | past | comments | ask | show | jobs | submit login
Writing a StarCraft Bot in F# (msdn.com)
105 points by tpiddy on Aug 23, 2010 | hide | past | favorite | 10 comments



I don't use Visual Studio or any of the .Net languages, but F# strikes me as pretty cool. For those who are using it, how does it compare to the experience of coding in ocaml? I'm guessing that the Visual Studio tooling and libraries add something compelling?


I've been using emacs, so the tooling is equally compelling. ;)

The nicest surprises so far have been:

- I can code in a fully dynamically typed manner for the parts of my code where it's more convenient. (To do this in O'Caml requires manual wrappers and/or some camlp4 magic.)

- A nice set of sequence comprehensions and syntax for it, built-in.

The big downside is that there's no attempt whatsoever to unify the .NET-centric OO language model and the O'Caml functional language model: You're stuck alternating between writing code in C#-with-some-type-inference or in O'Caml.

(If you want that unified model: Look at scala.)


Yes, you get the Intellisense, debugging, analysis tools, etc from Visual Studio (which are quite nice). More importantly, you get the ability to use any existing .net assembly, including .net itself (kind of like some of the JVM-based functional languages get access to Java).


Thanks, it looks like it might be a nice way to learn an ML dialect, once I have time to dig into it.


It has been very good so far. The visual studio support is excellent. You get code highlighting (of course), intellisense, you don't have to worry about building and compiling (just hit run), debugging, compilation is fast, execution is fast, there is an interactive repl. And last but not least: you get access to the whole suite of .NET libraries: http, gui libraries, parsers for various formats, access to databases, etc.

The most important annoyance is that you often need to explicitly upcast objects. For example if you have a String and a function that takes Object you need to upcast the String to Object.


I agree the need to explicity upcast has been annoying. I'm hoping they will do a compiler optimzation to fix that in a future release. Also, hopefully they will bring in the co/contra variance features that are now in C# for lists and apply them to Tuple as well. (Does Don Syme read HN?)


I don't know if he reads HN but I believe the F# team is aware of the upcasting issue and if I remember correctly they were thinking about resolving this in the future. You can send him an email saying what you like and what are your biggest issues, he'll probably appreciate that (at least I would).


If you're interested in learning more, Ben Webber did a talk on the AIIDE 2010 StarCraft competition at SHDH36 that is worth watching: http://www.youtube.com/watch?v=PbjsL5E1Idw


I'm currently reading Chris Smith's (author of this post) book 'Programming F#' (the iPhone app version). I highly recommend it if you are interested in F#.


As he's now working for Google (http://achrissmith.blogspot.com/2010/05/one-month-in.html) I wonder if he's still involved with F# (Google employees not being able to use Windows and all).

update: To answer my own question, I asked him, and he responded: http://twitter.com/aChrisSmith/status/21929022794

I love the internet.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: