4 ms·
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
by rlmw 16y ago
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.
- StavrosK 16y agoHow does Clojure compare with these? It's time I learnt a functional language...
- kgo 16y agoYou 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.
- StavrosK 16y agoAh, that's very interesting, thank you. I assume Scala is typed, then?
- whakojacko 16y agoIf by typed I assume you mean "statically typed", then yes.
- kgo 16y agoScala'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.
- StavrosK 16y agoThanks 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)?
- pufuwozu 16y agodex 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.