Article View: comp.lang.functional
Article #966Re: Values escaping their type definition
From: Jon Hanson
Date: Fri, 18 Dec 1992 04:32
Date: Fri, 18 Dec 1992 04:32
42 lines
1864 bytes
1864 bytes
In article <BzDIL1.B4I@cs.uiuc.edu>, morrison@cs.uiuc.edu (Vance Morrison) writes: > I have just realized something about ML that I find rather odd and > I am hoping to get some advice about consequences. > > The oddity is that a value can escape the scope in which its type > definition was made. Thus > > > let > datatype aType = constA | constB of int; > in > constA > end; > > > This of course returns the value 'constA', in the outer scope, but > in this scope there is no type for this value!! > > I tried this SML of NJ and it accepted it and returned the message > > val it = constA : ?.aType > > It seems to me that this can cause problem with the sematics of > the language and would be a problem in any language that allows > type definitions in inner scopes. > > Now my problem is that I don't know what the exact problems this > could cause, and I was hoping that those who have had more experience > both defining and implementing ML could give their input. > > I have a copy of the Definition of ML, so if something there would > make this clear, please feel free to refer to it. > > Vance Doesn't the "?.aType" mean that the object has a hidden type, ie a type inaccessible in the current type environment. There is nothing you can actually do with the returned value, so no problems should occur. . |on Hanson `-' jaxh@dcs.ed.ac.uk
Technical Details
Message-ID:
<BzFtyD.BJA@dcs.ed.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!pipex!warwick!uknet!edcastle!dcs.ed.ac.uk!jaxhReferences:
<BzDIL1.B4I@cs.uiuc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!warwick!uknet!edcastle!dcs.ed.ac.uk!jaxh From: jaxh@dcs.ed.ac.uk (Jon Hanson) Newsgroups: comp.lang.functional Subject: Re: Values escaping their type definition Message-ID: <BzFtyD.BJA@dcs.ed.ac.uk> Date: 18 Dec 92 04:32:36 GMT References: <BzDIL1.B4I@cs.uiuc.edu> Sender: cnews@dcs.ed.ac.uk (UseNet News Admin) Organization: Department of Computer Science, University of Edinburgh Lines: 42