From: Lukasz Stafiniak <lukstafi@gmail.com>
To: Ethan Burns <burns.ethan@gmail.com>
Cc: caml-list@yquem.inria.fr, Wheeler Ruml <ruml@cs.unh.edu>
Subject: Re: [Caml-list] Question about float refs.
Date: Thu, 19 Aug 2010 15:14:17 +0200 [thread overview]
Message-ID: <AANLkTi=206h_oWanTr2Wo8s0+FC=2uj-80tTM=ZZtuep@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimsE3czb5OxWm4V+bGY_75oQKhBL7N709iS9Djt@mail.gmail.com>
On Thu, Aug 19, 2010 at 1:52 PM, Ethan Burns <burns.ethan@gmail.com> wrote:
> Hello,
>
> I noticed a strange behavior when using references to floating point
> values. My suspicion, initially, was that the references would not be
> boxed because they are the same as a record with a single mutable
> field that is of type float. It seems that OCaml still boxes float
> refs.
Note that refs are just a standard polymorphic type defined in Pervasives:
type 'a ref = {
mutable contents : 'a ;
}
Being polymorphic, the "float ref" are not unboxed: imagine what would
happen when you passed them to a function
foo : 'a ref -> 'a list = fun x -> [ !x ]
or similar (with a negative occurrence of polymorphic ref).
next prev parent reply other threads:[~2010-08-19 13:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-19 11:52 Ethan Burns
2010-08-19 13:14 ` Lukasz Stafiniak [this message]
2010-08-19 13:34 ` [Caml-list] " David House
2010-08-19 13:49 ` Till Varoquaux
2010-08-23 12:06 ` Christophe TROESTLER
2010-08-23 12:14 ` Ethan Burns
2010-08-23 12:42 ` Sylvain Le Gall
2010-08-23 13:00 ` [Caml-list] " Dmitry Bely
2010-08-31 19:41 ` Jon Harrop
2010-09-01 7:18 ` Dmitry Bely
2010-09-01 7:46 ` Christophe TROESTLER
2010-09-01 8:31 ` Fabrice Le Fessant
2010-09-01 9:54 ` Ethan Burns
2010-09-01 12:29 ` Fabrice Le Fessant
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='AANLkTi=206h_oWanTr2Wo8s0+FC=2uj-80tTM=ZZtuep@mail.gmail.com' \
--to=lukstafi@gmail.com \
--cc=burns.ethan@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=ruml@cs.unh.edu \
/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