[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Delayed evaluation of expressions
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 1 Jul 2011 18:47:19 +0200
On Fri, Jul 1, 2011 at 12:36 PM, Jerome Vuarand
<jerome.vuarand@gmail.com> wrote:
> I understand that this "by-name" mechanism requires the compiler to
> know the callee prototype at the caller site,
Also, the programmer needs to know the prototype ;) I'm thinking here
of C++ reference parameters, which are less obvious than the old C
pass-a-pointer method. C# actually has a keyword 'ref' to make such
parameters stand out more.
So, assuming a list object that can be filtered, we could ask for a
list of all positive elements like so:
lpos = ls:filter(lazy _ > 0)
where lazy <expr> is short for function(_) return <expr> end
Having an explicit keyword/macro/whatever 'lazy' feels better than an
implicit quoting for arguments to this kind of function.
steve d.