News for hackers. Stuff that matters.
Re:MoonScript - A programmer friendly language that compiles... by chc on Thursday August 11, 2011 @04:23AM (#2871977)
I think you must be confused. OCaml is not all that punctuation heavy and doesn't have overloaded operators to make it punctuation heavy.
Re:MoonScript - A programmer friendly language that compiles... by jacques_chester on Thursday August 11, 2011 @05:05AM (#2872068)
I must be, but here's how I remember it (bearing in mind that memory is faulty).

A few years ago I took a unit in my comp sci degree, "Programming Paradigms". The language used for teaching was F#, which is heavily inspired by OCaml. At one point we were given readings on OCaml programs and a particular operator popped up -- something like "is subtype of", I fail to recall exactly -- and it looked like :>? or :?> or similar.

I bitched loudly in the unit forum about this operator, whereupon the professor politely informed me that he, in fact, had invented that little bit of syntax when he was a PhD student at INRIA.

He didn't flunk me! Dr Rowan Davies, still the most scary-smart computer scientist I've met.

Re:MoonScript - A programmer friendly language that compiles... by silentbicycle on Thursday August 11, 2011 @09:29AM (#2872704)
I haven't ever seen that in OCaml. Probably an F# extension.

If you're going to complain about OCaml's syntax, I would start with having to use different arithmetic ops for int vs. floating point (+ vs. +.) and different indexing operators for strings and arrays ( s.(0) vs. s.[0] ).

You get used to it pretty quickly, and OCaml more than makes up for it in other ways, but it is a bit annoying.

Re:MoonScript - A programmer friendly language that compiles... by jacques_chester on Thursday August 11, 2011 @09:43AM (#2872766)
He mentioned that he did a bunch of work object-system work on Caml that was published, but the INRIA guys didn't put it into the main version when they developed OCaml. It's possible it got transmitted into F# that way. Next time I see him I'll ask about it.
Re:MoonScript - A programmer friendly language that compiles... by chc on Thursday August 11, 2011 @03:13PM (#2874303)
On rereading, I realized this might give a false impression. OCaml does allow the user to define an operator, but a confluence of the type system (which doesn't allow overloading and makes abstracting types sufficiently difficult that it doesn't justify the minor syntactic nicety of a custom operators) and precedence rules means that most OCaml code you'll see does not use a lot of weird operators like you'll find in advanced Haskell code. I'm not an OCaml guru, but that's what I've seen.
Re:MoonScript - A programmer friendly language that compiles... by ppog on Friday August 12, 2011 @12:33AM (#2875985)
Not OCaml per se, but at least one F# library makes liberal and very effective use of custom operators: FParsec, Stephan Tolksdorf's parser combinator library (http://www.quanttec.com/fparsec/reference/primitives.html). Of course, FParsec is adapted from the Haskell Parsec library, so maybe that just makes your point for you!
Re:MoonScript - A programmer friendly language that compiles... by swah on Thursday August 11, 2011 @08:37AM (#2872518)
1.0 + 2.0 <- Not valid OCaml! :)

But I love OCaml, I don't why it isn't more hacked/forked.

Re:MoonScript - A programmer friendly language that compiles... by tomp on Thursday August 11, 2011 @09:22AM (#2872665)
> But I love OCaml, I don't why it isn't more hacked/forked.

Because it has a fucked-up licence - you're not allowed to "fork" it in the usual sense of the word, you can only distribute the original source, and your modifications in a patch. The "free-for-all" licence is only available to commercial users.