caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Damien Doligez <damien.doligez@inria.fr>
To: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Bless me Father, for I have used Obj.magic
Date: Fri, 30 Dec 2011 12:41:04 +0100	[thread overview]
Message-ID: <98C4A68D-2A7C-415E-BD0D-AD5ECAE7D238@inria.fr> (raw)
In-Reply-To: <4EF47360.2010302@inria.fr>

On 2011-12-23, at 13:26, Fabrice Le Fessant wrote:

> On 12/23/2011 01:04 PM, rixed@happyleptic.org wrote:
>> No you are right, once eta-epxanded the compiler accepted the code.
>> I wonder what difference it makes in the generated code, if any.
>> Thank you very much for the tip!
> 
> The difference is that the function is evaluated everytime you want to
> access the value. If the function is cheap and has no side-effect, it is
> perfectly fine, but if it is not the case, the cost will be much higher.

On the other hand, in the example shown by rixed the function expects
two arguments, so eta-expansion might even be more efficient because
you avoid going through the partial application machinery.

-- Damien


      reply	other threads:[~2011-12-30 11:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-22 21:24 rixed
2011-12-22 22:07 ` Fabrice Le Fessant
2011-12-22 22:19   ` rixed
2011-12-22 23:29 ` Thierry Martinez
2011-12-23 12:04   ` rixed
2011-12-23 12:26     ` Fabrice Le Fessant
2011-12-30 11:41       ` Damien Doligez [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=98C4A68D-2A7C-415E-BD0D-AD5ECAE7D238@inria.fr \
    --to=damien.doligez@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).