[bitc-dev] Call by need?

Jonathan S. Shapiro shap at eros-os.org
Thu Sep 2 09:03:56 PDT 2010


On Wed, Sep 1, 2010 at 9:21 PM, William Leslie <william.leslie.ttg at gmail.com
> wrote:

> On 2 September 2010 03:40, Jonathan S. Shapiro <shap at eros-os.org> wrote:
> > I have been thinking more about mixfix and its relationship to macro
> > processing. Actually, this was prompted in part by a weird thought
> > concerning blocks.
> >
>
> But if and, for example, always expected a function, and the function
> itself had to be explicit, you would get
>
> if {foo} and {{bar} or {baz}} then ...
>

I never said the thunking had to be explicit. My intention was that the
caller would still write:

    if foo and bar or baz then ...

Mark Miller has persuaded me that I should wait until there is a compelling
use case. I had intended to do that in any case; I was mainly asking to find
out if a compelling use case might already be known.


The thunking of sequences idea was for something else. It lets me write:

mixfix while_do_ = WhileDo
def WhileDo(tst : bool, body: fn () -> 'a) =
  if tst then body() else ()

That is: if blocks are a lightweight lambda, it becomes possible to
introduce forms that do something like control flow without reaching for
macros.

The ByNeed idea was for dealing with things like AND, where we don't want
syntactically explicit thunkification at the call site.


shap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.coyotos.org/pipermail/bitc-dev/attachments/20100902/a41f4f09/attachment.html 


More information about the bitc-dev mailing list