caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Cannasse" <warplayer@free.fr>
To: "Alain Frisch" <Alain.Frisch@inria.fr>, <caml-list@inria.fr>
Subject: Re: [Caml-list] Obj.dup crash ?
Date: Thu, 30 Dec 2004 12:04:09 +0100	[thread overview]
Message-ID: <002f01c4ee5f$49820ca0$0100a8c0@warp> (raw)
In-Reply-To: <41D358E2.4000604@inria.fr>

> Concerning Obj.dup, I guess it is never actually called when the block
> has 0 fields. Actually, where is Obj.dup used except in
> CamlinternalOO.copy ?  Quick look. It is used in the code generator:
> for array constants of size > 4, and for record expressions { ... with
> ... } that copy the original record and then modify it (but the empty
> record is not a valid type !). So indeed, it seems that Obj.dup is never
> called for 0 fields blocks. The implementation has dead code, but
> it is not buggy ;-)

It's also used in ExtLib DynArray when copying an array ;)
I understand that Obj is an undocumented/unspecified module but it should at
least work as expected.
Is there a particular reason for 0 fields blocks not being allocated ?
Actually Obj.tag (Obj.new_block 0 0) returns 500 which is not really the
expected result.

> but the empty record is not a valid type

It can't be parsed using default caml syntax but it surely can be
represented into the AST since I expect it to be a "something list". Now I'm
not sure such a type would pass the type checker or even how you're supposed
to instanciate it :)

Having 0 fields blocks might be useful for high level language features that
want to use OCaml as their runtime system, because of its very good native
compilation.

Nicolas Cannasse


  parent reply	other threads:[~2004-12-30 11:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-29 13:38 Nicolas Cannasse
2004-12-29 15:49 ` [Caml-list] " Alain Frisch
2004-12-29 16:49   ` Nicolas Cannasse
     [not found]     ` <41D358E2.4000604@inria.fr>
2004-12-30 11:04       ` Nicolas Cannasse [this message]
2004-12-30 21:48         ` 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='002f01c4ee5f$49820ca0$0100a8c0@warp' \
    --to=warplayer@free.fr \
    --cc=Alain.Frisch@inria.fr \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).