Le Friday 06 Jan 2012 à 15:18:05 (-0800), DelPhiNus a écrit :
> You are right, I just read this:
> http://www.mpi-sws.org/~rossberg/sml-vs-ocaml.html
> 
> Evaluation order is undefined for tuples – use let, e.g.
> 
> In SML it would be: (inputLine stdIn, inputLine stdIn)
> 
> In Ocaml you have to explicitely write two successive assigments.
> let line1 = read_line () in
> let line2 = read_line () in
> (line1, line2)
> 
> This is really suprising to have such limitation. As far as I know,
> the ocaml evaluation is not supposed to be lazy unlike List.

I do not see lazyness here, but evaluation order which is not enforced.

Honestly, it's much less worse than throwing a C++ exception in one of
the two args of a C++ function of arity 2...

> The crazy thing is that I have tons of code that is almost never
> failing while there could be several mistakes like this with
> construction with unpredictible order.

Rule of thumb: avoid mutable states as much as possible.

> The other crazy thing is the test that Chris King did, the behavior
> with the pattern '(a, b) as c' is broken and this is unacceptable.

This is indeed worrying, as it seems the mutation side-effect is nested
within the pattern matching code. Or rather that the side-effect took
place between the matching of ev and the construction of the tuple.

You could arguably file that as a bug, though I'm not so sure that it
fully qualifies as such. It breaks an invariant, sure, but you asked for
unpredicable side-effects anyway...

> For that reason, I am more and more frequently searching "Ocaml sucks"
> on Google...

Well, YMMV.

> I am really getting very disappointed to experience problems like
> that...

Avoid unnecessary mutability is the easy answer.

> I am waiting for the next "popular" and safe functionnal langage with
> a better grammar, predictible and user-friendly evaluation order,
> build on several platforms, more complete library, binding with C, or
> based on JVM but with a better integration than Scala, etc...

That's asking for quite a lot. You've got strict functional languages
with type systems that would catch that, but syntactically you're far
worse (ATS, typically). Haskell would outright disallow the kind of
issues you've been running in, but that's hardly a win in my opinion.
More complete library and easy binding to C takes a lot of work (but CIL
or clang might help there). As for wanting a better JVM integration than
Scala, that seems to me outright excessive.

I've got a few more items on my wish list...

-- 
     Guillaume Yziquel

-- 
You received this message because you are subscribed to the Google Groups 
"ocaml-developer" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ocaml-developer?hl=en
For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html

Reply via email to