Hacker News new | ask | show | jobs
by strlen 5912 days ago
Re: Scala

This is off topic, I'd suggest playing with Scala. In addition to ML family influences (immutability, pattern matching, tail recursion, static typing with type inference, optional lazy evaluation, etc...) it's also very true to the Smalltalk/Ruby vision: everything is an object, there are Mixins (one can mixin multiple traits, which can contain implementation code unlike Java's interfaces), it's really easy to write your own control structures (despite the lack of macros).

Afaik, one of the implementers Clojure's collections was also Odersky's student at EPFL. So there's talk now if seeing them back in Scala (it can also be done directly e.g., http://github.com/codahale/yoink)

OCaml had shown to me that statically typed languages can still be very expressive and succinct. Scala shows that OO + static typing combination has been unfairly tainted by C++ and Java.

The only "issue" with Scala is that it does aim to be entirely backwards and forwards compatible with Java. There are countless obvious benefits (e.g., being able to use tools such as Jetty's websocket support, freely mixing actors together with j.u.concurrent, using mixins to enrich/"de-boilerplate" existing libraries/APIs), but it does mean that some features aren't as robust as they are elsewhere in ML family (pattern matching is better in OCaml).

It's interesting if F# had to do the same "Faustian Bargain" (perhaps the CLR allows for more flexibility?), I'll have to play with it under Mono.

That being said, there is one 70s/80s concept that I'd like to see more widely used: dynamic typing, with optional static type hints -- to allow for judicious optimization. Common Lisp does this beautifully (at least with SBCL and CMUCL you can actually examine assembly code and see it match what you'd write by hand). Some Smalltalk VMs had been able to do this as well.

Clojure does do type hints, at least for Java interop. Interestingly, HotSpot VM is based on Strongtalk (one such Smalltalk VM). With Clojure re-awakening Strongtalk's ideas while running on what was once its VM, we may be coming full circle :-)

1 comments

Hopefully off topic but interesting is OK on HN:

I've developed a strong "allergy" for "traditional" OO; perhaps/probably unfairly, since it's based on a lot of C++ work I did in the '90s, and it's as anti-dynamic (not just in typing :-) as you can get in the OO world (insert Alan Kay's comment here (I think it was about C++)) ... but it's also based on my recoiling in distaste from seriously learning Java for some Clojure related stuff, too much accidental complexity. My tastes in languages run a lot more to the Scheme end of things (T may remain my favorite Lisp dialect and language of all time) so my current language interests are more like:

Play with Haskell since there's so much ferment there.

Learn a pre-OCaml ML so that I can grok all the ML based FP literature from the period before Haskell's ascent.

Help liberate Clojure from Java: as part of the Clojure in Clojure effort, work on what I call Turtle Clojure ("It's turtles all the way down"). While a Lisp traditionalist, I'm willing to "Get rid of cons!" (http://news.ycombinator.com/item?id=814632) but I'd like to see what can be done without Java in the middle. I can't imagine that Java tuned GC is optional for something so seriously functional as Clojure, so that's what I'm looking at the most. Maybe an Appel-Ellis-Li GC can be efficient under Xen (it uses VM for read barriers, but traditional OSes don't optimize that path (10,000 cycles circa 1990)).

The thing I find most interesting and challenging in the area of programming is the single address space multi-core SMP problem, which Clojure is very most focused on and is obviously very relevant at a time when I can buy a x86-64 4 core 8 MB shared L3 cache server class chip from Intel for as little as $200.

I have done the mixin thing with Flavors (proto-CLOS) and C++, and, yeah, the pure Java people don't know what they're missing.