[Omake] lazy values in arrays?

Erick Tryzelaar erickt at dslextreme.com
Mon Jan 29 00:55:07 PST 2007


Erick Tryzelaar wrote:
> Boy I'm chatty today :)
>
> Is there any way to store a lazy value in an array? The obvious route 
> doesn't work: 

Another day, another bug/feature request? :)

I'm trying lazy array construction, and I ran into another bug. It looks 
like you can't access a field through a lazy value. For instance:

% X. =
X>        X. =
X>           foo[] = 1 2 3
X>           bar = $`(array $(foo), 4)
X>           .
.
% echo $(X.bar.map $(fun o, $o))
*** omake error:
   File -: line 3, characters 15-21
   unbound variable: foo

Of course, if you force evaluation or don't use a lazy value, it works:

% x = $(X.bar)
% echo $(x.map $(fun o, $o))
1 2 3 4
% echo $(X.foo.map $(fun o, $o))
1 2 3

Is this on purpose? It'd be handy if this was supported.

Also while we're talking about member access, what about supporting 
"$($(foo bar).baz)" style expressions? Currently you need to either use 
a temporary variable, or implement a function like "$(baz $(foo bar))", 
which would be inconvenient for a lot of member functions.

-e


More information about the Omake mailing list