From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA17815 for caml-red; Sun, 20 Aug 2000 19:05:22 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA06684 for ; Sat, 19 Aug 2000 18:57:46 +0200 (MET DST) Received: from mail.cs.uu.nl (sunset.cs.uu.nl [131.211.80.32]) by concorde.inria.fr (8.10.0/8.10.0) with ESMTP id e7JGvj115854 for ; Sat, 19 Aug 2000 18:57:45 +0200 (MET DST) Received: from silvester.cs.uu.nl.cs.uu.nl (silvester.cs.uu.nl [131.211.80.119]) by mail.cs.uu.nl (Postfix) with ESMTP id F0A82451E; Sat, 19 Aug 2000 18:57:44 +0200 (MET DST) From: Frank Atanassow MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14750.48264.608634.961622@silvester.cs.uu.nl> Date: Sat, 19 Aug 2000 18:57:44 +0200 (MET DST) To: reig@dcs.gla.ac.uk Cc: caml-list@inria.fr Subject: Question on language design (keywords vs Pervasives) In-Reply-To: <200008180207.LAA05417@ropas.kaist.ac.kr> References: <200008180207.LAA05417@ropas.kaist.ac.kr> X-Mailer: VM 6.75 under Emacs 20.4.1 Sender: weis@pauillac.inria.fr Fermin Reig writes: > 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, [..elided..] > > 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? Maybe the ability to rebind was some small motivation, but I imagine the goal of simplicity was the more significant factor. Why make "int" or "raise" a keyword if you don't need to? Even if you rebind "int", say, functions operating on the new "int" will not work on the old. Conversely, if you made "int" or "raise" a keyword, why stop there? You could also make a whole range of other notions special: reals, complex numbers, associative maps, commands (procedures with types of the form A -> unit), file I/O primitives, regular expressions, certain shell-related procedures... maybe you can guess where I'm heading. :) Of course, it's true OTOH that as keywords we could be slightly more confident that we haven't made a mistake and overlooked some rebinding, but in practice most people leave "int" and "raise" alone, or if they're rebound, then that's done in another module and the fact that we're not talking about Pervasives.int, say, is explicit in the fact that we call it "ModuleX.int", say. (BTW, I'm not involved with Ocaml.) -- Frank Atanassow, Dept. of Computer Science, Utrecht University Padualaan 14, PO Box 80.089, 3508 TB Utrecht, Netherlands Tel +31 (030) 253-1012, Fax +31 (030) 251-3791