Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have been playing with F# a fair bit and I am totally in love with the language. I wish it was a jvm language given that is what I ply my trade on (and no scala is not as elegant imo)


F# is indeed very interesting! For the JVM, one alternative (based on Haskell 2010, so it has philosophical similarities to F#) is Frege (https://github.com/Frege/frege). Frege is probably even less mainstream than F#, though. I don't use it because I'd rather code in Haskell using GHC.


While it's not an ML-style language, I've found that I enjoy Clojure the most when it comes to JVM alternatives. The lack of F#-style pattern matching makes a few things feel less elegant, but the general structure of my code is extremely similar.


There is core.match[1], and between the restructuring bind, multimethods, and the ability to create polymorphic functions like hello in this example[2], you can replicate a lot of common FP idioms reasonably well. It's not pretty, but Clojure generally isn't.

[1] https://github.com/clojure/core.match [2] https://github.com/lazerwalker/clojurescript-koans/blob/mast...


The trouble with Scala is that developer A writes elegant mostly-functional code while developer B uses global state modified in nested while-loops with everything as type Any. I think more of a bondage language approach would be better.


Agreed this is a problem. For example, I had to educate my boss about Option vs null, and I'm still not sure he gets it (he's an old school C-and-then-Java programmer).

On the other hand, it's possible to "not get it" and write messy code in even the most bondage-oriented languages.


You can just disallow the compilation of anything where null appears, as well as plenty of other style issues.

The language gives you plenty of tools to enforce the appropriate coding style for a given project.


Interesting! Didn't know that. But note two things:

1- In the more general case, you cannot enforce a rule to disallows clumsy/inelegant code. You cannot force proper use of the language.

2- In the Option/null case, this is an education problem. My boss is an old-school programmer with lots of experience (and I've seen him successfully solve and/or prevent real problems at work that bit every other team, so by no means I want to sound disrespectful of his experience), but he simply doesn't understand why Option is needed. He claims "defensive programming should be enough" (i.e. checking for null at every turn). He claims "academia is not good for anything", and I guess he sort of believes Scala is an academic language full of fancy but not really useful constructs. He is not completely sold on functional programming, pattern matching, etc. So I cannot simply have the language complain about nulls, because I must justify the enforcement of this rule to my boss, and he isn't convinced. (Note: this isn't limited to Option values; think of almost every feature/coding style from Scala that might sound unfamiliar to Java programmers, and it's the same problem with my boss).


You could maybe try Yeti or ocaml-java.




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

Search: