caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <Alain.Frisch@inria.fr>
To: Christophe Raffalli <raffalli@univ-savoie.fr>
Cc: Brian Hurt <bhurt@spnz.org>, caml-list@inria.fr
Subject: Re: [Caml-list] Obj or not Obj
Date: Mon, 28 Nov 2005 09:43:24 +0100	[thread overview]
Message-ID: <438AC32C.5040604@inria.fr> (raw)
In-Reply-To: <438A4CAA.6070006@univ-savoie.fr>

Christophe Raffalli wrote:
> - using Obj requires the same knowledge as writing C interface ...

It requires more knowledge: you must know how GC roots in the stack are
detected in native code. In this respect, (Obj.magic 0) and (Obj.magic
()) are not the same, contrary to what you might believe if you only
know how to write a C interface. (Obj.magic 0) makes the code generator
believe that the result can only be an integer; it will thus not traced
by the GC. Now, the same happens for the result of an expression like
(if ... then Obj.magic 0 else ...) because the compiler knows, thanks to
the type system, that if the then branch is an integer, then so is the
else branch. You can imagine the consequences. (I've made this mistake -
good thing Xavier was not too far.)

-- Alain


  parent reply	other threads:[~2005-11-28  8:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-25 23:53 Efficency of varient types Michael D. Adams
2005-11-26  0:31 ` [Caml-list] " Nicolas Cannasse
2005-11-26  1:22   ` Brian Hurt
2005-11-26  9:39     ` Nicolas Cannasse
2005-11-28  0:17     ` Obj or not Obj Christophe Raffalli
2005-11-28  8:41       ` [Caml-list] " Nicolas Cannasse
2005-11-28  9:27         ` Christophe Raffalli
2005-11-28  9:33         ` skaller
2005-11-28  8:43       ` Alain Frisch [this message]
2005-11-26  2:54   ` [Caml-list] Efficency of varient types skaller
2005-11-27  5:06   ` Michael D. Adams
2005-11-27  5:45     ` Brian Hurt
2005-11-27 10:02       ` Nicolas Cannasse
2005-11-27 15:35       ` Michael D. Adams
2005-11-27 18:08         ` Brian Hurt
2005-12-02 15:07           ` Michael D. Adams
2005-11-26  1:18 ` Jon Harrop
2005-11-27 14:57 ` Lukasz Stafiniak
2005-11-27 15:47   ` Lukasz Stafiniak
2005-11-28  8:14   ` Christophe Raffalli
2005-11-28  7:24 ` David Baelde
2005-11-28  7:49   ` Jacques Garrigue
2005-11-28 10:01     ` Jon Harrop
2005-11-28 10:26       ` Luc Maranget
2005-11-28  7:53   ` Ville-Pertti Keinonen
2005-12-01 17:05 ` Stefan Monnier
2005-12-02 15:07   ` [Caml-list] " Michael D. Adams

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=438AC32C.5040604@inria.fr \
    --to=alain.frisch@inria.fr \
    --cc=bhurt@spnz.org \
    --cc=caml-list@inria.fr \
    --cc=raffalli@univ-savoie.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).