Browse thread
Question on language design (keywords vs Pervasives)
[
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@m...> |
| Subject: | Re: Question on language design (keywords vs Pervasives) |
Pierre Weis wrote: > The ``users can rebind'' argument is definitively what we intended > when we decided to allow the rebinding of usual operators (infix or > prefix symbols, such as +, -, *, ...). For ``raise'' this is not so > clear, since redefining ``raise'' is a very bad idea to obtain a > readable Caml program. I'm not sure I agree with that. If raise is the _standard_ way to raise an exception, then it _should_ be rebindable (and be defined in terms of a more primitive function). The reason is precisely to permit hooking it by the user, which is an extremely common requirement. For example, to introduce some extra logging. In C++, exceptions are raise by a keyword 'throw', and it is a pain, because good practice dictates NOT to ever raise an exception directly with 'throw', but to call a (template) function usually defined to simply raise the exception (using throw). This permits replacing the function to, for example, print an error message to stderr, as well as throwing the exception. The problem is, this doesn't work for any third party code, or even one's own code, if the idea occurs to one belatedly. -- 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