🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.functional
Article #963

Re: Values escaping their type definition

#963
From: Andrew Koenig
Date: Thu, 17 Dec 1992 15:28
30 lines
1261 bytes
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
Technical Details
Message-ID: <24432@alice.att.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!uwm.edu!linac!att!att!allegra!alice!ark
References: <BzDIL1.B4I@cs.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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