Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Evaluation Order
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-06-11 (11:21)
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,
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper
download Interscript
Bug reports:  FAQ:
To unsubscribe, mail  Archives: