[Haskell-cafe] strict, lazy, non-strict, eager

Eugene Kirpichov ekirpichov at gmail.com
Sun Dec 25 07:30:26 CET 2011


Thanks, this makes sense.

On Sun, Dec 25, 2011 at 10:03 AM, Dan Doel <dan.doel at gmail.com> wrote:

> On Sun, Dec 25, 2011 at 12:14 AM, Eugene Kirpichov <ekirpichov at gmail.com>
> wrote:
> > On Sat, Dec 24, 2011 at 10:49 PM, Dan Doel <dan.doel at gmail.com> wrote:
> >> I think it's good to be clear on all these specifics, and people could
> >> do with a better recognition of the difference between (non-)strict
> >> and (lazy)eager (hint: you can have an eager, non-strict language).
> >
> > Can you elaborate? That's apparently my blind spot.
>
> A while back, there was a paper on something called (I believe)
> optimistic evaluation. The strategy goes like this: when you evaluate
> 'f x', first you start evaluating 'x'. If that takes too long, or you
> encounter an exception, you (re)thunk it, and continue evaluating the
> body of f lazy style, in case you don't really need x.
>
> This is arguably eager, since you reduce arguments to functions
> immediately if possible. And it has some advantages over lazy
> evaluation in common cases. For instance, it avoids foldl building up
> a huge nested thunk that would cause a stack overflow. But it isn't
> strict, because
>
>    const 5 undefined
>
> is still 5.
>
> You can also imagine sparking on every function application, so that
> arguments automatically get reduced in parallel, and as soon as
> possible. I think that's been determined to not be very effective,
> though.
>
> -- Dan
>



-- 
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111225/8f06fb28/attachment.htm>


More information about the Haskell-Cafe mailing list