On Fri, 2004-05-28 at 01:39, Nicolas Cannasse wrote:
> If you want such a function, provide a constructor for it:
> >
> > val make_int_generator: unit -> (unit ->int)
> >
> > but leave it up to the client to instantiate.
>
> Sorry but as a careful programmer, I'm against the fact of "protecting the
> programmer from bad usages".
Then go back to programming in C.
The function above is in the spirit of Ocaml.
It is completely re-entrant and purely functional
and requires the programmer to arrange sharing as they see fit.
If the programmer wants to use a global variable they can
easily write:
let unique = make_int_generator ();;
Leave this decision to the programmer to shoot themselves
in the head if they want. Don't encourage it or provide
a function that a careful programmer would in fact find
useless .. perhaps belatedly.
Its bad enough the standard distro has crap like Str
module in it. Lets not make the same mistake.
--
John Skaller, mailto:skaller@xxxxxxxxxxxx
voice: 061-2-9660-0850,
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
|