home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!uwm.edu!linac!att!att!allegra!alice!ark
- From: ark@alice.att.com (Andrew Koenig)
- Newsgroups: comp.lang.functional
- Subject: Re: Values escaping their type definition
- Message-ID: <24432@alice.att.com>
- Date: 17 Dec 92 15:28:53 GMT
- Article-I.D.: alice.24432
- References: <BzDIL1.B4I@cs.uiuc.edu>
- Reply-To: ark@alice.UUCP ()
- Organization: AT&T Bell Laboratories, Murray Hill NJ
- Lines: 30
-
- In article <BzDIL1.B4I@cs.uiuc.edu> morrison@cs.uiuc.edu (Vance Morrison) writes:
-
- > 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!!
-
- More precisely, it returns a value that the compiler knows how to print
- as constA, of a type which you have no way to name. Why is that any
- more disturbing from this?
-
- let
- datatype aType = constA | constB of int
- type aType = int
- in
- constA
- end
-
- Here you can mention constA but you can't write its type either, because
- aType is hidden.
-
- Incidentally, in both cases, aType, constA, and constB are out of scope
- after the `end' and you can't use any of them.
- --
- --Andrew Koenig
- ark@europa.att.com
-