Thread View: uiuc.cs.sml
1 messages
1 total messages
Started by Joshua Caplan
Mon, 27 Jul 1992 06:09
modules system and type sharing
Author: Joshua Caplan
Date: Mon, 27 Jul 1992 06:09
Date: Mon, 27 Jul 1992 06:09
52 lines
1763 bytes
1763 bytes
Suppose I have a signature signature S = sig eqtype i (* various declarations involving type i *) end and wish to implement a functor functor F (s : S) = struct type j = (* representation for j *) (* various appearances of the things in s *) end where I know that type s.i = type j ? I can think of only one way, which I hate: signature RequiredArgToF = sig datatype j = USELESS_TAG of (* representation for j *) end functor F (structure s : S and t : RequiredArgToF sharing type s.i = t.j) = struct local open t in type j = j (* various appearances of the things in s and *) (* lots of USELESS_TAGs *) end end This solution requires me to move the type declarations needed in F outside of F to be sent in as a required argument, and makes me stick tags all over the place which I don't really need. If it were possible to pass F an argument of functor type ((sig eqtype i end) -> S), the result would be beautiful. But alas, that might complicate the modules system type discipline too much. Suggestions? -- ------------------------+------------------------------------------------- caplan@cs.uiuc.edu | Joshua Caplan | Department of Computer Science | University of Illinois at Urbana-Champaign
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads