Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: skaller@ozemail.com.au
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Bug in typing polymorphic variants found
Date: Mon, 13 May 2002 15:46:39 +0900	[thread overview]
Message-ID: <20020513154639Z.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <3CDBF8AD.5070000@ozemail.com.au>

From: John Max Skaller <skaller@ozemail.com.au>

> [This is a bug report, please ignore if you are not interested,
> apologies in advance ..]

> The *problem* is that the type of the constructor argument
> influences its run-time hash? And so the following code,
> which IS executed
> 
>         | `DCL_val t ->
>           Hashtbl.add dfns n (id,sr,parent,`SYMDEF_dcl dcl)
>           ;
> 
> is producing the *wrong* hash for the variant `SYMDEF_dcl dcl,
> because the inference engine thinks the type of dcl is something
> other than dcl_t. When I do a lookup of the hash table later in another 
> module,
> I get a bad value out, since in *that* module, the correct type of the dcl
> is calculated. At least, thats my guess.

Well, your guess has to be wrong, because the type of a constructor
arguments _does not_ influence the run-time hash of this constructor.

> The complete source of my program is available from
> 
>     http://felix.sourceforge.net/felix_src.tgz
> 
> See the web site:
> 
>   http://felix.sourceforge.net/download.html
> 
> for information on building.
> 
> To use the included build scripts, you must have Python installed.
> After unpacking the tarball, type
> 
>      python script/maker noiscr test
> 
> and it should build the compiler and then crash running
> some of the tests. If you try the whole process again,
> using Ocaml 3.01 it should work.

I didn't try with 3.01, only with 3.04+10, and I get a segmentation
fault on the first example.
Since you use ocamlopt, I couldn't get any debugging information, so I
tried again with ocamlc -g, and the error I get is a stack overflow.
I expect there is a bug somewhere in your program...

It is a good idea to make your makefiles to work with both ocamlc and
ocamlopt, because ocamlc gives you much more debugging information.
Some segmentation faults with ocamlopt give actually informative
errors with ocamlc.

By the way, I got errors trying to compile felix, because there was an
old src/flx_parse.ml, which should not be there.

> I have commented out the lines that cause Ocaml 3.01 to
> give a diagnostic message. If you wish to generate the
> Ocaml 3.01 errors that Ocaml 3.04 does not report,
> you will need to uncomment those lines.

Parts of the specification of polymorphic variants have changed since
3.01, so it is very possible than some code refused by 3.01 is now
accepted. I would expect this code to be sound.

> I will do everything I can to help resolve this problem,
> I'd like to use new ocaml features .. and of I am already
> depending on
> 
>     #variant_type
> 
> syntax in matches, which will not be supported in Ocaml 3.05.

Where did you get this idea? Of course #variant_type will stay, this
is a main feature of polymorphic variants!
The only change is that I would prefer people to move from the
#variant_type to [< variant_type] in _types_, since the previous
notation is overloaded with the one for objects in a not so nice way.
But there is no reason to hurry: both syntax will still be supported
in 3.05.

Cheers,

Jacques Garrigue
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2002-05-13  6:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-02 11:26 [Caml-list] OCaml-announcements Oliver Bandel
2002-05-07 13:43 ` Xavier Leroy
2002-05-07 14:42   ` Remi VANICAT
2002-05-07 16:05     ` Matt Armstrong
2002-05-08 14:58   ` [Caml-list] Weird bug John Max Skaller
2002-05-08 15:45     ` John Max Skaller
2002-05-08 20:10       ` [Caml-list] Bug in typing polymorphic variants found John Max Skaller
2002-05-10 15:02         ` Luc Maranget
2002-05-10 16:43           ` John Max Skaller
2002-05-13  6:46             ` Jacques Garrigue [this message]
2002-05-13  9:21               ` Luc Maranget
2002-05-13 16:35                 ` John Max Skaller
2002-05-13 16:05               ` John Max Skaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020513154639Z.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=skaller@ozemail.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox