caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Florian Douetteau" <Florian.Douetteau@ens.fr>
To: "Jacques Garrigue" <garrigue@kurims.kyoto-u.ac.jp>
Cc: <caml-list@pauillac.inria.fr>
Subject: Re: [Caml-list] Obj.magic, Obj.t etc.
Date: Thu, 14 Aug 2003 10:22:00 +0200	[thread overview]
Message-ID: <002401c3623d$22c3f2e0$0201a8c0@foorama> (raw)
In-Reply-To: <20030814105551S.garrigue@kurims.kyoto-u.ac.jp>


>
> As an interesting aside, I've discovered recently that even Obj.repr
> is dangerous:
>
> # Obj.repr;;
> - : 'a -> Obj.t = <fun>
> # let arr = Array.create 1 (Obj.repr 1.0);;
> val arr : Obj.t array = [|<abstr>|]
> # arr.(0) <- Obj.repr 1;;
> Segmentation fault
>
> >From a subtyping point of view, this basically means that there cannot
> be any "top" element in the ocaml type system.

To be fully accurate, it only means that the current implementation of the
code generator would
not support it directly.
If subtyping was to be supported, an unboxed float array would be created
iff
its the compile-time type "float array" (it would be created boxed if typed
"Top array")  .

I don't know if the current runtime implementation makes other assumptions
of the same kind about the lack of subtyping;
for instance, the gc could avoid marking the content of an array starting
with an unboxed integer ? Same thing about list cells.

--
Florian

-------------------
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:[~2003-08-14  8:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-13 18:49 Christopher Dutchyn
2003-08-14  1:55 ` Jacques Garrigue
2003-08-14  8:22   ` Florian Douetteau [this message]
2003-08-14  8:34     ` Jacques Garrigue
2003-08-14 10:45       ` Marcin 'Qrczak' Kowalczyk
2003-08-15  0:14         ` Jacques Garrigue
2003-08-15 10:32         ` skaller
2003-08-15 10:52           ` Marcin 'Qrczak' Kowalczyk
2003-08-15 15:54             ` brogoff
2003-08-15 10:31       ` skaller
2003-08-18 10:04     ` Xavier Leroy
2003-08-19  7:33       ` Jacques Garrigue

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='002401c3623d$22c3f2e0$0201a8c0@foorama' \
    --to=florian.douetteau@ens.fr \
    --cc=caml-list@pauillac.inria.fr \
    --cc=garrigue@kurims.kyoto-u.ac.jp \
    /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).