RE: Proposal for study: Add a categorical Initial type to ocaml

From: Manuel Fahndrich (maf@microsoft.com)
Date: Fri Oct 15 1999 - 01:16:54 MET DST


From: Manuel Fahndrich <maf@microsoft.com>
To: "'skaller'" <skaller@maxtal.com.au>
Subject: RE: Proposal for study: Add a categorical Initial type to ocaml
Date: Thu, 14 Oct 1999 16:16:54 -0700

I did not word what I meant correctly. In the case of initial values, errors
can occur anywhere in the code, namely, whenever I access an uninitialized
value. Since these values can live in records, and the records can be passed
around, the error can occur anywhere.

Now, with a well-defined and encapsulated use of Obj.magic, such errors can
be avoided. E.g. in the extensible array case, I can write the module in
such a way that no matter what code I write outside of that module (not
using Obj.magic), it cannot result in an error.

-Manuel

-----Original Message-----
From: skaller [mailto:skaller@maxtal.com.au]
Sent: Thursday, October 14, 1999 3:44 PM
To: Manuel Fahndrich
Cc: caml-list@inria.fr
Subject: Re: Proposal for study: Add a categorical Initial type to ocaml

Manuel Fahndrich wrote:
>
> skaller wrote:
>
> [...]
>
> > Like I've been saying, with option you can turn it off, with
> Obj.magic, the implementor ought to be damned sure he's doing things
right.
> But with these special "uninitialized value" sorts of things, people like
> me who've gotten used to good type systems keep looking over their
> shoulders because they're afraid it might turn around and bite
> them in the butt.
>
>> How is this different from Obj.magic? Can't that bite you
>> in the ass too?
>
>>> The difference is that in the first case of uninitialized values, they
can
>>> crop up anywhere in your program, since they get propagated. Using
Obj.magic
>>> within a special module such as resizable arrays confines the danger to
that
>>> module. The programmer can make sure (through extensive code reviews of
a
>>> finite piece of code) that outside the module, things cannot go awry.

        No. It is the other way around. Obj.magic values can get
propagated, and so cause a problem. The special initial can NOT
be propagated. Any attempt to copy such a value raises an exception.
Ensuing this does not happen is also a matter of hiding within
a modular abstraction, but at least an exception will help
detect such localised errors.

-- 
John Skaller, mailto:skaller@maxtal.com.au
1/10 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
downloads: http://www.triode.net.au/~skaller



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:27 MET