[Omake] allowing for lazy extends?
Erick Tryzelaar
erickt at dslextreme.com
Sun Jan 28 16:04:03 PST 2007
Aleksey Nogin wrote:
>> Without it, I run into all sorts of issues because "extends" forces
>> evaluation, even if it's a lazy variable. So I have to do all sorts
>> of hacks in order to avoid extending things until the last possible
>> moment.
>
> Note that you can implement lazy extension yourself:
Thanks for that! That does exactly what I want. I did notice that it
does add some extra things (name, var, val) to my object, which I'm not
sure is on purpose:
% EXECUTABLE +=
EXECUTAB> EXECUTABLE +=
EXECUTAB> .
.
- : class Object
object-length = <fun 0>
object-map = <fun 1>
object-mem = <fun 1>
com = <fun 2>
exe = <sequence> : Sequence
flags = <sequence> : Sequence
make-rule = <fun 2>
object-find = <fun 1>
object-add = <fun 2>
comflags = <fun 2>
object-foreach = <fun 3>
% C. =
C> C. =
C> lazy_extend(C)
C> .
.
- : class Object
object-length = <fun 0>
object-map = <fun 1>
object-mem = <fun 1>
com = $(apply global.obj-find $(apply global.getvar "C" :
Sequence) "com" : Sequence)
name = $(apply global.obj-find $(apply global.getvar "C" :
Sequence) "name" : Sequence)
exe = $(apply global.obj-find
$(apply global.getvar $(apply global.obj-find $(apply
global.getvar "C" : Sequence) "name" : Sequence))
"exe" : Sequence)
flags = $(apply global.obj-find
$(apply global.getvar $(apply global.obj-find $(apply
global.getvar "C" : Sequence) "name" : Sequence))
"flags" : Sequence)
make-rule = $(apply global.obj-find
$(apply global.getvar $(apply global.obj-find
$(apply global.getvar "C" : Sequence) "name" : Sequence))
"make-rule" : Sequence)
object-find = <fun 1>
val = <fun 3>
var = "object-foreach" : Sequence
object-add = <fun 2>
comflags = $(apply global.obj-find
$(apply global.getvar $(apply global.obj-find
$(apply global.getvar "C" : Sequence) "name" : Sequence))
"comflags" : Sequence)
object-foreach = <fun 3>
> P.S. On one hand, I would prefer not to make any significant semantic
> changes in 0.9.8 - finishing the work on scalable variable scoping and
> reuniting the two branches has priority.
>
> On the other hand, we do need to take a systematic look at how the
> laziness is implemented and probably come up with a more flexible and
> consistent approach - see the discussion at
> http://bugzilla.metaprl.org/show_bug.cgi?id=628
I'm fine with using this for now. It'll be nice to have this integrated,
but now it's no longer a showstopper :)
-e
More information about the Omake
mailing list