caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] "type foo = Foo | Bar | Baz"  vs.  "type foo = Foo | Baz | Bar"
@ 2016-03-10 19:47 Oliver Bandel
  2016-03-10 19:50 ` David Allsopp
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Bandel @ 2016-03-10 19:47 UTC (permalink / raw)
  To: caml-list

Hello,

I got an error message when the ml-file and the mli-file
have a sum-type, where the order of the type definitionis different.

This seems to be new, at least I did not found such an error message before.

===========================================================================
File "foo.ml", line 1:
Error: The implementation foo.ml does not match the interface foo.cmi:
        Type declarations do not match:
          type foo = Foo | Bar | Baz
        is not included in
          type foo = Foo | Baz | Bar
        File "foo.ml", line 1, characters 0-26: Actual declaration
        Fields number 2 have different names, Bar and Baz.
===========================================================================

I looked for warning-/error-codes, to look, if checking the order
of the definition of a type can be switched on and off.

But I didn't found a number, that I can use with -w-switch.

Any ideas on this?

Ciao,
    Oliver




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Caml-list] "type foo = Foo | Bar | Baz"  vs.  "type foo = Foo | Baz | Bar"
  2016-03-10 19:47 [Caml-list] "type foo = Foo | Bar | Baz" vs. "type foo = Foo | Baz | Bar" Oliver Bandel
@ 2016-03-10 19:50 ` David Allsopp
  2016-03-10 20:59   ` Oliver Bandel
  0 siblings, 1 reply; 3+ messages in thread
From: David Allsopp @ 2016-03-10 19:50 UTC (permalink / raw)
  To: Oliver Bandel, caml-list

Oliver Bandel wrote:
> Hello,
> 
> I got an error message when the ml-file and the mli-file have a sum-type,
> where the order of the type definitionis different.
> This seems to be new, at least I did not found such an error message
> before.
> 
> ==========================================================================
> =
> File "foo.ml", line 1:
> Error: The implementation foo.ml does not match the interface foo.cmi:
>         Type declarations do not match:
>           type foo = Foo | Bar | Baz
>         is not included in
>           type foo = Foo | Baz | Bar
>         File "foo.ml", line 1, characters 0-26: Actual declaration
>         Fields number 2 have different names, Bar and Baz.
> ==========================================================================
> =

It has always been the case, but I think the error message used to be much less clear.

> I looked for warning-/error-codes, to look, if checking the order of the
> definition of a type can be switched on and off.
> 
> But I didn't found a number, that I can use with -w-switch.

It's not a warning, so you can't switch it off - having a different order of constructors makes the type different (it changes the runtime representation).


David 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] "type foo = Foo | Bar | Baz" vs. "type foo = Foo | Baz | Bar"
  2016-03-10 19:50 ` David Allsopp
@ 2016-03-10 20:59   ` Oliver Bandel
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Bandel @ 2016-03-10 20:59 UTC (permalink / raw)
  To: David Allsopp; +Cc: caml-list


Zitat von David Allsopp <dra-news@metastack.com> (Thu, 10 Mar 2016  
19:50:34 +0000)

> Oliver Bandel wrote:
>> Hello,
>>
>> I got an error message when the ml-file and the mli-file have a sum-type,
>> where the order of the type definitionis different.
>> This seems to be new, at least I did not found such an error message
>> before.
>>
>> ==========================================================================
>> =
>> File "foo.ml", line 1:
>> Error: The implementation foo.ml does not match the interface foo.cmi:
>>         Type declarations do not match:
>>           type foo = Foo | Bar | Baz
>>         is not included in
>>           type foo = Foo | Baz | Bar
>>         File "foo.ml", line 1, characters 0-26: Actual declaration
>>         Fields number 2 have different names, Bar and Baz.
>> ==========================================================================
>> =
>
> It has always been the case, but I think the error message used to  
> be much less clear.

Hmhhh, maybe I just did not changed the order before.
(I often used  ocamlc -i to generate mli-files and then removed the  
unneeded stuff from them,
so I didn't changed the order.)


>
>> I looked for warning-/error-codes, to look, if checking the order of the
>> definition of a type can be switched on and off.
>>
>> But I didn't found a number, that I can use with -w-switch.
>
> It's not a warning, so you can't switch it off - having a different  
> order of constructors makes the type different (it changes the  
> runtime representation).
[...]

OK, thanks for the explanation.


Ciao,
    Oliver


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-10 20:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-10 19:47 [Caml-list] "type foo = Foo | Bar | Baz" vs. "type foo = Foo | Baz | Bar" Oliver Bandel
2016-03-10 19:50 ` David Allsopp
2016-03-10 20:59   ` Oliver Bandel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).