News for hackers. Stuff that matters.
Re:Ask HN: What do you think of F#? by rlmw on Sunday October 24, 2010 @02:00PM (#1826714)
I can appreciate some of these concerns - though the ability to run under mono ameliorates them for me. If you want a language aiming for a similar functional + oop position but don't want to touch Microsoft stuff then Scala might be worth taking a look. Thats assuming you don't extend your fears to Java Virtual Machines as well.
Re:Ask HN: What do you think of F#? by StavrosK on Sunday October 24, 2010 @02:59PM (#1826892)
How does Clojure compare with these? It's time I learnt a functional language...
Re:Ask HN: What do you think of F#? by kgo on Sunday October 24, 2010 @03:47PM (#1827036)
You can break functional languages down into two basic categories: Typed and Untyped. The typed ones derive from ML, and the untyped ones derive from Lisp.

Many of the 'killer features' of untyped functional languages have migrated their way into today's 'dynamic' languages like ruby, python, etc. You can use a REPL, you don't need to spend 15 minutes compiling, no static typing, etc. So in terms of 'new' things you'll learn from Clojure, you have s-exps and macros. This allows you to manipulate code as data, because the code is data.

The typed functional languages have an advanced type system, as the name indicates. In 'normal' languages, you have what I casually refer to as 'primitive types' Integers, Floats, Doubles, etc, and after that you're on your own. Typed functional languages have ADT's that allow you to model complicated systems via the types. Probably the standard example of a real-life use of this is that you can write code that will throw an error at compile time if you try to inadvertently try to add Feet and Meters. They also have pattern matching, which is pretty handy. Imagine a big if-elsif statement that will throw a compile time error if you handle bank transfers up to a million dollars, and transfers over two million dollars, but not ones that are between one and two-million dollars. You can think of both of these features as typedefs and case/if-elsif statements on crack. That's the kind of stuff you'll get from F#.

I personally think the typed functional languages have much more compelling features in this day and age. Like I said above, the features that I really dug in Lisps have made their way into most dynamic languages, and don't seem as mind-blowing as they once did. But if you really want to go crazy, it's probably worth learning at least one language from each functional sub-family at some point in time.

Re:Ask HN: What do you think of F#? by StavrosK on Sunday October 24, 2010 @03:50PM (#1827046)
Ah, that's very interesting, thank you. I assume Scala is typed, then?
Re:Ask HN: What do you think of F#? by kgo on Sunday October 24, 2010 @04:07PM (#1827107)
Scala's...

weird...

Scala would fall under the typed functional family. It has it's own version of ADT's and it has pattern matching. But in a lot of ways it's a hybrid OO/Functional language. A lot of the decisions in the language's design were made so that it'd play nice with Java-proper.

My initial superficial feelings about it was that it combined the worst of both worlds. It had all the popularity of a functional language, and all the nice syntax of Java.

Since then I've started writing a Droid app to get a real feel for the language, and all my superficial feelings were wrong. I like the language a lot. But it's still a little weird compared to all the other typed functional languages. You can't see as much ML in Scala as you can in F# or even Haskell.

Still, if you're stuck (or prefer) the JVM, then that's probably the typed functional language you'd want to try. That's the reason I'm using it for Droid development.

Re:Ask HN: What do you think of F#? by StavrosK on Sunday October 24, 2010 @04:31PM (#1827172)
Thanks for that. The apps run on Android? I thought Dalvik only supported Java... Or is there a Scala -> Java compiler (or Java bytecode -> Dalvik bytecode, for that matter)?
Re:Ask HN: What do you think of F#? by pufuwozu on Sunday October 24, 2010 @06:47PM (#1827579)
dex is an executable that comes with the SDK and converts files from .class (Java bytecode) to .dex (Dalvik bytecode)

For a while there was a bug in the Dalvik VM that wouldn't let you run some Scala methods but I made a patch to fix that problem. I think it's in all releases after Android 1.6.

Re:Ask HN: What do you think of F#? by StavrosK on Sunday October 24, 2010 @07:01PM (#1827619)
Ah, I see, fantastic. I thought it compiled the code into .dex. I imagine it might run Jython as well, then?

EDIT: Apparently Jython uses on-the-fly bytecode generation on account of being dynamic, so it can't run.

Re:Ask HN: What do you think of F#? by pufuwozu on Sunday October 24, 2010 @07:08PM (#1827635)
The Android Scripting project adds support for Python, Perl, JRuby, Lua, BeanShell, JavaScript and Tcl:

http://code.google.com/p/android-scripting/

Re:Ask HN: What do you think of F#? by rbxbx on Sunday October 24, 2010 @09:53PM (#1828080)
http://www.mirah.org/ (formerly Duby) is another compelling candidate for Android development for those that like Ruby. Compiles to Java byte-code :)
Re:Ask HN: What do you think of F#? by StavrosK on Sunday October 24, 2010 @07:18PM (#1827660)
That's very handy, thank you!
Re:Ask HN: What do you think of F#? by whakojacko on Sunday October 24, 2010 @03:57PM (#1827073)
If by typed I assume you mean "statically typed", then yes.