Browse thread
[Caml-list] Evaluation Order
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Max Skaller <skaller@o...> |
| Subject: | Re: [Caml-list] Evaluation Order |
David McClain wrote: > The results of these two operations, integers, are arithmetically commutable > under addition. But what isn't commutable is the order in which these > operations occur. No current type checking in OCaml (or any other language > with which I am familiar) could help catch this mistake. In principle, the Felix type checker would prevent this: side-effects are not permitted in functions. In practice, I had to relax the syntax permitted in functions, and the current translator doesn't check for side effects yet. You can also cheat, by wrapping C functions as Felix functions: there's no way to check if the C function has side effects or not. The reason for relaxing the rules is that it is very ugly and insecure to write things like: val x : int; // uninitialised variable! fetch(&x, &state_object); instead of val x : int = fetch(&state_object); I can't think of good way around this though. -- John (Max) Skaller, mailto:skaller@maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr