Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001634OCamlOCaml generalpublic2003-04-13 06:022003-05-05 16:56
Reporteradministrator 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001634: Feature wish: enhanced module constraints
DescriptionFull_Name: Brian Rogoff
Version: OCaml
OS:
Submission from: 12-234-83-176.client.attbi.com (12.234.83.176)


Hi,
  In the latest round of thrashing over the parameterization trick hack for
encoding mutually recursive type and functor instantiations, an old annoyance
reared it's head again so I decided I'd see if you want to fix it.

  The problem is that when we have a signature which exports two types (say,
Set.S, which exports t and elt) and we'd like to enforce that these two types
are
related like in the following, where Ord.t is obviously a polymorphic type

(* Not legal!!! *)

module MakeRec(Ord: OPEN_ORDERED) : (S with type elt = t Ord.t) =
                                                       ^-- how to refer to S.t?
  struct
  ...
  end

the only way I think we can do this now is to expand the signature S out with
the
type equalities coded in the expanded sig. If that's right, that is a
shortcoming
of the module system, and very un-Caml-like in it's verbosity, as I now have to
repeat the whole signature just to get the type equality I want. I understand
that neither "t" (which t does that refer to) nor "S.t" will work there, but
isn't this just syntax? Can't something like the following, also not legal
OCaml, be made to work?

module MakeRec(Ord: OPEN_ORDERED) : (S with type t and type elt = t Ord.t) =
  struct
  ...
  end

where we first mention the t so that we know we're talking about the t in the
struct being defined, and then refer to it.

I trust that fixing this is easier than fixing the recursive module problem :-)

-- Brian

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker