[Omake] $" " inside of a lazy expansion $`( ) still expands $()

David Cooke david.m.cooke at gmail.com
Sun Sep 10 15:33:00 PDT 2006


Hi,

I came across this trying to figure out why OCAMLPACKS wasn't working
(this is with the 0.9.8.x branch in svn). Variables $() inside of
omake quotes $" " inside of a lazy expansion $`() are expanded at
definition time, not lazily.

Here's a transcript from osh to show the problem:

% FILES[] = a b c
- : <array
       "a" : Sequence
       "b" : Sequence
       "c" : Sequence>
       : Array
% SUF = .c
- : ".c" : Sequence
% X = $`(addsuffix $(SUF), $(FILES))
- : $(apply global.addsuffix $(apply global.SUF) $(apply global.FILES))
% echo($X)
a.c b.c c.c
% # add a omake quotation with $" "
% X = $`(addsuffix $"$(SUF)", $(FILES))
- : $(apply global.addsuffix <data ".c"> : String $(apply global.FILES))
% # uh oh, that doesn't look good. And it isn't...
% SUF = .x
- : ".x" : Sequence
% echo($X)
a.c b.c c.c

In the second assignment to X, I use $"$(SUF)", which ends up getting
expanded at definition time, not lazily as the $`() should make it.

PREFIXED_OCAMLPACKS uses this construct, so assigning to OCAMLPACKS
afterwards doesn't do anything. I've fixed this in my version by just
removing the quotes in PREFIXED_OCAMLPACKS (since commas are used as
the separators).

--
David M. Cooke
david.m.cooke at gmail.com


More information about the Omake mailing list