[Omake] SVN Commit: OMake Build System [0.9.8.x] (Rev. 11352)

Aleksey Nogin anogin at hrl.com
Thu Jul 19 14:23:36 PDT 2007


On 19.07.2007 14:03, Jason Hickey wrote:

>> map. =
>>    extends $(Map)
>>    $|key| = old
>>
>> map.foreach(key, val)
>>    map = $(map.add $(key), new)
>>    export map
>>
>> new = $(map.find key)
>> if $(not $(equal $(new), new))
>>    println($"Error: expected new, got $(new)")
>>    exit 1
> 
> Why do you expect "new"?
> 
> There is a conflict here between the preserving variables in the body, 
> or the variable in the hoist.

Well, I have relatively little idea what you just said ;-).

Note that my expectation is not based on the current implementation of 
Map.foreach in Pervasives.om (which very well might be a part of the 
problem), I am simply commenting on user-visible behavior of Map.foreach 
that appears broken in current 0.9.8.x (both on its own merits and 
compared to 0.9.8.4).

I would have expected
    foo.foreach(key, val)
       body
to remain roughly equivalent to
    tmp_function(key, val) =
       body

    tmp_function(key1, val1)
    tmp_function(key2, val2)
    ...
    tmp_function(keyn, valn)
(for each pair of keyi/vali in map foo).

Note that the following does, of course, update properly:
    map. =
       extends $(Map)
       $|key| = old
    update(key, val) =
       map = $(map.add $(key), new)
       export map
    update(key, new)

Why should foreach be any different?

Aleksey

-- 
Aleksey Nogin, Research Scientist
Advanced Technologies Department, Information & System Sciences Lab
HRL Laboratories, LLC, Malibu, CA


More information about the OMake-Devel mailing list