> I took a quick look in FunSqueak, I'll have to take a deeper look when I get
> a minute. Two questions:
> * does it address the debuggability issue Bert mentioned for blocks?
If you're caught in the debugger while the LMS block fails, no. But
since the structure of that block is exposed via the LMS, it is possible
to debug by erasing all compiled forms in the suspected code and see the
same error that was in the block appear within the evaluation of the
original LMS. Don't know if I'm being clear here.
> * can it have state?
Yes, via default values stored in LambdaSlots. Look in the class-side of
NFunction for examples, like:
-----------------
hyperbolicDamping
| decayRate |
decayRate _ Lambda scale default: 1; description: 'x scaling'; type:
NumericSlot.
^ (Lx abs /// decayRate + 1) reciprocal
-----------------
In that code, decayRate is a lambda slot whose default gives the
returned LMS state:
NFunction hyperbolicDamping
-->
Lx.Lscale.{((<x> abs /// <scale>) + 1) reciprocal}
NFunction hyperbolicDamping defaultForm
-->
Lx.{((<x> abs /// 1) + 1) reciprocal}
(NFunction hyperbolicDamping parametrize: #scale default: 42) defaultForm
-->
Lx.{((<x> abs /// 42) + 1) reciprocal}
This is a step away from pure functional programming but it is very
useful in practice.
muO has lots of examples of LMS usage; if you want to explore them get
the ready-to-go image at
http://www.zogotounga.net/comp/squeak/muo/muO%20257%20image.zipbest,
Stef