home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / function / 1475 < prev    next >
Encoding:
Internet Message Format  |  1992-12-20  |  1.8 KB

  1. Path: sparky!uunet!pipex!warwick!uknet!edcastle!dcs.ed.ac.uk!jaxh
  2. From: jaxh@dcs.ed.ac.uk (Jon Hanson)
  3. Newsgroups: comp.lang.functional
  4. Subject: Re: Values escaping their type definition
  5. Message-ID: <BzFtyD.BJA@dcs.ed.ac.uk>
  6. Date: 18 Dec 92 04:32:36 GMT
  7. References: <BzDIL1.B4I@cs.uiuc.edu>
  8. Sender: cnews@dcs.ed.ac.uk (UseNet News Admin)
  9. Organization: Department of Computer Science, University of Edinburgh
  10. Lines: 42
  11.  
  12. In article <BzDIL1.B4I@cs.uiuc.edu>, morrison@cs.uiuc.edu (Vance Morrison) writes:
  13. > I have just realized something about ML that I find rather odd and 
  14. > I am hoping to get some advice about consequences.
  15. > The oddity is that a value can escape the scope in which its type
  16. > definition was made.   Thus
  17. >     let 
  18. >        datatype aType = constA | constB of int;
  19. >     in
  20. >        constA
  21. >     end;
  22. > This of course returns the value 'constA', in the outer scope, but
  23. > in this scope there is no type for this value!!
  24. > I tried this SML of NJ and it accepted it and returned the message
  25. >         val it = constA : ?.aType
  26. >  
  27. > It seems to me that this can cause problem with the sematics of
  28. > the language and would be a problem in any language that allows
  29. > type definitions in inner scopes.  
  30. > Now my problem is that I don't know what the exact problems this 
  31. > could cause, and I was hoping that those who have had more experience
  32. > both defining and implementing ML could give their input.  
  33. > I have a copy of the Definition of ML, so if something there would
  34. > make this clear, please feel free to refer to it.
  35. > Vance
  36.  
  37. Doesn't the "?.aType" mean that the object has a hidden type, ie a type inaccessible
  38. in the current type environment. There is nothing you can actually do with the
  39. returned value, so no problems should occur.
  40.  
  41.    .
  42.    |on Hanson
  43.  `-' jaxh@dcs.ed.ac.uk
  44.