Ada-like "PRIVATE" Types in SML? 
Author Message
 Ada-like "PRIVATE" Types in SML?

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;


Joel F. Klein

B.T.W., why is there so little activity in alt.lang.ml?



Sun, 08 Jan 1995 10:20:53 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. limited private types, "=" operator

2. Ada 0y wish list: "with private"

3. No Boolean type in "types"

4. Yet another "About private methods" question

5. "with private" and generics

6. private "subtype"s

7. Class design: accessing "private" members

8. "private" class attributes

9. Class design: accessing "private" members

10. "Private" methods

11. string.join(["Tk 4.2p2", "Python 1.4", "Win32", "free"], "for")

12. Ambiguity in Ada LRM about private types and type conversions

 

 
Powered by phpBB® Forum Software