Version française
Home     About     Download     Resources     Contact us    
Browse thread
Question on language design (keywords vs Pervasives)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Fermin Reig <reig@r...>
Subject: Question on language design (keywords vs Pervasives)
Hi,

I'm curious about some interesting language design choices in ocaml
3.0.

* "raise", "exn" are not keywords, but definitions in the Pervasives module.

This means that I can rebind them, for ex., like this:

# type exn = char;;
type exn = char

# let raise x = x + 1;;
val raise : int -> int = <fun>

Similarly for other types in the Pervasives module, like int,
etc. (However, "exception", for declaring a new exception is a
reserved word).

I can speculate that the intention is precisely that praogrammers be
able to rebind them at will, or maybe that it simplifies implementing
interpreters/compilers, but I don't know for sure. Could anyone
(preferably someone involved in the design) comment on the rationale
for these choices?

Thanks,

Fermin Reig

------------------------------------------------------
Department of Computing Science, University of Glasgow
http://www.dcs.gla.ac.uk/~reig