[PRL] scope of top-level defines

Eli Barzilay eli at barzilay.org
Tue Apr 5 15:30:14 EDT 2005


On Apr  5, John Clements wrote:
> 
> On Apr 5, 2005, at 2:03 AM, Eli Barzilay wrote:
> 
> > I don't have enough experience to do this in a few minutes, and
> > there's no reason for it to not be easily doable -- but the whole
> > point is that I have the strict world for such things, so why
> > bother?
> 
> Because if you use strict constructs in lazy languages, you'll get
> bizarro[*] sequencing.  With monadic I/O, the effects will be
> observed in the same sequence that you would have seen if the
> program had been evaluated in a non-lazy way.  That's the whole
> point of monadic I/O, right?

But with a strict-lazy combination you completely bypass the
bizarroness problem: you do all I/O in the strict side.  The best you
can get if you want non-bizarro I/O is to use some constructors which
represent I/O operations, then scan the result on the strict side and
perform the required operations.  IIUC, that would be an
implementation of an IO monad, where the strict side does the same as
the black magic which is part of a Haskell implementation.  (And if I
had some experience using these things then I'm sure it would be
simple to provide the same interface.)

(And if you redefine #%app, you can go all the way and have such forms
like `(x >>= y)'...)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!



More information about the PRL mailing list