caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hartmann Schaffer <schaffer@albedo.net>
To: skaller@users.sourceforge.net
Cc: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>,
	caml-list@pauillac.inria.fr
Subject: Re: [Caml-list] laziness
Date: Sat, 04 Sep 2004 16:40:02 -0400	[thread overview]
Message-ID: <413A2822.3030408@albedo.net> (raw)
In-Reply-To: <1094296869.3352.280.camel@pelican.wigram>

skaller wrote:

>On Sat, 2004-09-04 at 18:40, Marcin 'Qrczak' Kowalczyk wrote:
>  
>
>>skaller <skaller@users.sourceforge.net> writes:
>>
>>    
>>
>>>However if the call is *inlined* to get
>>>
>>>	if c' then a' else b'
>>>
>>>then perhaps a' or b' will never be evaluated.
>>>      
>>>
>>No. Inlining is considered an optimization, which implies that it
>>doesn't change the semantics except when it was not fully specified
>>in the first place.
>>    
>>
>
>I understand that argument -- but that doesn't mean the
>compiler conforms to the specification, nor that the
>specification is best.
>
>  
>
>>E.g. the order of evaluation of arguments is
>>unspecified, so it might be different depending on inlining; but
>>OCaml does specify that each argument are evaluated exactly once
>>and inlining doesn't change that.
>>    
>>
>
>Must they be evaluated before the function is called?
>
>  
>
on the first pass, yes (in order maintain the meaning of the code).  
depending on the optimizer, later optimizations might be able to 
suppress some of the evaluations (e.g. if the value of c' can be 
determined at compile time)

hs

-------------------
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


  parent reply	other threads:[~2004-09-04 20:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-04  6:30 skaller
2004-09-04  8:40 ` Marcin 'Qrczak' Kowalczyk
2004-09-04 11:21   ` skaller
2004-09-04 11:49     ` Richard Jones
2004-09-04 20:40     ` Hartmann Schaffer [this message]
2004-09-05 10:50 ` Jon Harrop
2004-09-05 14:07   ` skaller
2004-09-05  1:07 Jason Smith
2004-09-05  5:46 ` skaller
2004-09-06  0:57 ` Richard Jones
2004-09-06  6:11   ` Nicolas Cannasse
2004-09-06  8:24   ` skaller
2004-09-06  8:44   ` Erik de Castro Lopo
2004-09-06 12:55   ` Jon Harrop
2004-09-06 16:21     ` William Lovas
2004-09-06 22:35   ` Hartmann Schaffer
2004-09-07  8:31     ` Richard Jones
2004-09-07  8:37       ` Nicolas Cannasse
2004-09-06  9:07 Jason Smith
2004-09-06 10:18 ` skaller
2004-09-06  9:16 Jason Smith
2004-09-06 12:17 Jason Smith
2004-09-06 17:00 ` skaller

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=413A2822.3030408@albedo.net \
    --to=schaffer@albedo.net \
    --cc=caml-list@pauillac.inria.fr \
    --cc=qrczak@knm.org.pl \
    --cc=skaller@users.sourceforge.net \
    /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).