|Anonymous | Login | Signup for a new account||2015-08-04 11:46 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000778||OCaml||OCaml general||public||2002-01-04 22:56||2013-08-31 12:44|
|Target Version||Fixed in Version|
|Summary||0000778: type constraints and interface files|
|Description||Full_Name: Dan Arnon|
Submission from: 184.108.40.206 (220.127.116.11)
I defined the following module type:
module type X =
with type t = t
The type constraint at the end of the type of module Y looks cyclic, but it
shouldn't be: it basically means
that the type t of Y should be the same as the type t of X. The compiler seems
to understand that and it compiles this without any complaint. However, the .mli
file that it creates looks a bit different:
module type X =
module Y :
type t = t
This is just another way to express the same constraint. So far so good.
However, when I try to compile the .mli file, I get the following error:
"The type abbreviation t is cyclic"
There is a problem here somewhere: if the compiler accepted my type definition,
and then converted it to what it considered to be an equivalent type definition,
then it should accept its own definition as well and compile it without any
complaint. If it wants to complain, it must complain about my original
definition already. If in fact the two definitions are not equivalent for some
reason, then the compiler should not convert one to the other.
|Tags||No tags attached.|
> Full_Name: Dan Arnon
> Version: 3.02
> The type constraint at the end of the type of module Y looks cyclic, but it
> shouldn't be: it basically means
> that the type t of Y should be the same as the type t of X. The compiler
> to understand that and it compiles this without any complaint. However, the
> file that it creates looks a bit different:
> module type X =
> type t
> module Y :
> type t = t
> This is just another way to express the same constraint. So far so good.
No: this one is cyclic. The only proper way to describe your type is probably
your original definition. But it would be really messy to have the
pretty-printer do that, so you will have to correct the .mli by hand until
somebody finds a better way.
A simple workaround is either to use another name for your type, or to put the
first ocurrence in another submodule.
module type X = sig
module T : sig type t end
module Y : sig type t = T.t end
module type X' = X with type T.t = int
|Silly printing problem. Use workaround.|
The pretty-printer is not absolutely guaranteed to output correct OCaml code.
This would be pretty hard to fix, and the problem is really small.
This won't be fixed in the forseeable future.
|2005-11-18 10:13||administrator||New Issue|
|2012-01-06 15:39||doligez||Note Added: 0006612|
|2012-01-06 15:39||doligez||Status||acknowledged => resolved|
|2012-01-06 15:39||doligez||Resolution||open => suspended|
|2012-01-06 15:39||doligez||Description Updated||View Revisions|
|2013-08-31 12:44||xleroy||Status||resolved => closed|
|Copyright © 2000 - 2011 MantisBT Group|