From: David Teller <David.Teller@univ-orleans.fr>
To: "Tom Primožič" <tom.primozic@gmail.com>
Cc: Caml <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Safe Obj.magic container ?
Date: Wed, 27 Feb 2008 22:22:46 +0100 [thread overview]
Message-ID: <1204147367.7005.9.camel@Blefuscu> (raw)
In-Reply-To: <c1490a380802270323l10c3613ajaacfc30e862e62cb@mail.gmail.com>
On Wed, 2008-02-27 at 12:23 +0100, Tom Primožič wrote:
> The following are my experience and guesses, nothing
> scientific/official/thoroughly tested:
> 1. can I assume that this is always going to work if u is
> 'a.'a ?
>
> Well, there is no type 'a.'a. You can have:
> type u = { everything: 'a . 'a }
That's actually what I meant.
> but this presupposes that values of type u are blocks
> (heap-allocated). Therefore, if you cast a boolean (true) to type u,
> and then try to access the everything field of the "new" value, you
> will get a segfault.
Ok.
>
> 3. assuming the answer to 1. is No, is there a type u or a
> simple
> manipulation which should work for any type t ? Or perhaps
> just for
> polymorphic variants ?
>
> type u = int
> this will work for any type. You can even do pointer manipulation with
> it (adding and subtracting even numbers of bytes).
>
> Sorry everybody.
Er... I can't quite figure if it's a joke.
> - Tom
Cheers,
David
--
David Teller
Security of Distributed Systems
http://www.univ-orleans.fr/lifo/Members/David.Teller
Angry researcher: French Universities need reforms, but the LRU act brings liquidations.
prev parent reply other threads:[~2008-02-27 21:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-27 9:09 David Teller
2008-02-27 9:43 ` [Caml-list] " Luc Maranget
[not found] ` <37B36607-9F22-4537-B4DB-1E04348E2B90@inria.fr>
2008-02-28 14:23 ` Damien Doligez
2008-02-28 15:29 ` David Teller
2008-02-28 16:24 ` Damien Doligez
2008-02-29 1:52 ` Jacques Garrigue
2008-02-29 8:18 ` David Teller
2008-02-28 19:20 ` Jake Donham
2008-02-28 23:19 ` Richard Jones
2008-02-27 11:23 ` Tom Primožič
2008-02-27 21:22 ` David Teller [this message]
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=1204147367.7005.9.camel@Blefuscu \
--to=david.teller@univ-orleans.fr \
--cc=caml-list@yquem.inria.fr \
--cc=tom.primozic@gmail.com \
/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