🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.lang.ml
Article #7

Ada-like "PRIVATE" Types in SML?

#7
From: Kernel Account
Date: Wed, 22 Jul 1992 02:20
40 lines
1441 bytes
I don't have _good_ reference material for SML, so here goes:

If I am creating a module with a signature (see example), how can I  
effectively hide the declaration of a datatype referred to in the sig?   
I want to make file_contents_type "private," ala Ada.  Is this even  
possible?

Example (pseudo-SML source)
---------------------------

structure MyModule:
  sig
	(* How can I do the following in SML?
	   datatype file_contents_type is private
	*)

	datatype file =
	  emptyfile
	| opened of {
		     (*some other fields here*)
		     contents:file_contents_type
		    };

	(*some other things in the sig here*)
  end =

  struct
	(* definition of file_contents_type here *)

	(* rest of definitions *)
end;


Please email replies to kleinjf@cs.rose-hulman.edu


Joel F. Klein

B.T.W., why is there so little activity in alt.lang.ml?
Technical Details
Message-ID: <1992Jul22.022053.1424@cs.rose-hulman.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!sdd.hp.com!ux1.cso.uiuc.edu!usenet.ucs.indiana.edu!newshost.cs.rose-hulman.edu!news

Show Full Headers
Complete Article Headers
Newsgroups: alt.lang.ml,comp.lang.functional
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!sdd.hp.com!ux1.cso.uiuc.edu!usenet.ucs.indiana.edu!newshost.cs.rose-hulman.edu!news
From: kernel@NeXTwork.Rose-Hulman.Edu (Kernel Account)
Subject: Ada-like "PRIVATE" Types in SML?
Message-ID: <1992Jul22.022053.1424@cs.rose-hulman.edu>
Keywords: ml,private types
Sender: news@cs.rose-hulman.edu (The News Administrator)
Nntp-Posting-Host: lonelyserver.nextwork.rose-hulman.edu
Organization: Rose-Hulman Institute of Technology
Date: Wed, 22 Jul 1992 02:20:53 GMT
Lines: 40