[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Semantics of let
es's let is the same as scheme's let*. that is,
let (a = xxx; b = yyy) { ... }
is equivalent to
let (a = xxx) { let (b = yyy) { ... } }
this should be documented if it isn't.
note that the same property holds for local bindings, but does not
hold for for. (that is,
for (i = a b; j = 1 2) echo $i $j
prints
a 1
b 2
which is marginally useful.)
thinking about it, it would probably be more consistent to make
let and local not do any of their bindings until all of their
terms are evaluated. that is, so
x = foo
y = bar
let (x = $y; y = $x) echo $x $y
should print
bar foo
not
bar bar
what do other people on this list think?
re letrec: currently the only way to create recursive structures
is to use assignment or something like the y combinator. there is
no letrec. for now, this is a good thing, because exporting a
recursive structure causes the interpreter to either
(1) export something which can't be imported properly
(which happens in the simpler cases), a
(2) fall over and die.
this will be fixed in es-0.9.
when recursive structures work better, should es have a letrec? (it probably
will have something very much like letrec to support importing of recursive
structures, but should it be exposed to the users as letrec?)
> And what will (read: should)
> let ((a b)=1 {a=2}) {$b; echo $a}
> print, when multiple assignments are added to the language?
the same thing as it does now, since let will not be a letrec.
> ; fn Y f {@ g {$g $g} @ h {$f {$h $h}}}
a sincere round of applause, along with the first ever obfuscated es script
prize, has been earned. i knew that should work, but it's great to see
someone actually do it.
paul