home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.functional
- Path: sparky!uunet!spool.mu.edu!sdd.hp.com!ux1.cso.uiuc.edu!cs.uiuc.edu!morrison
- From: morrison@cs.uiuc.edu (Vance Morrison)
- Subject: Values escaping their type definition
- Message-ID: <BzDIL1.B4I@cs.uiuc.edu>
- Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL
- Date: Wed, 16 Dec 1992 22:31:49 GMT
- Lines: 46
-
-
- Hello,
-
- 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
-
-
- P.S. : I am also curious about a discussion about the problem
- with arbitrary Type definitions in signatures. Unfortuately
- I did not save it. If someone has the reference to the
- relevant passage in the Definition Book I would love to
- get that too.
-
-
-
-