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
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: 2000-08-18 (11:16)
From: Fermin Reig <reig@r...>
Subject: Question on language design (keywords vs Pervasives)

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

* "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?


Fermin Reig

Department of Computing Science, University of Glasgow