[116514] trunk/base/src
Gustaf Neumann
neumann at wu.ac.at
Mon Jan 27 10:01:25 PST 2014
dear all, i am afraid, that i am responsible for this bug, i was too
eager in bracing expressions.
Anyhow, unless i am missing something essential, i would recommend to
simplify the construct for "const" and to drop the helper proc "_const" in
proc const {name args} {
interp alias {} $name {} _const [expr $args]
}
##
# Helper function to define constants
#
# @see const
proc _const value {
return $value
}
and to use the following definition instead
proc const {name args} {
proc $name {} [list return [expr $args]]
}
This is less code, less magic and should be nearly twice as fast.
best regards
-gustaf
Am 27.01.14 17:52, schrieb Clemens Lang:
> On Tue, Jan 28, 2014 at 03:20:55AM +1100, Joshua Root wrote:
>> This doesn't look right. I would think the purpose of the expr here is
>> to do constant folding, so if you do
>>
>> const FOO 2+2
>>
>> then [FOO] would return 4. But with the added braces it returns "2+2".
> You're right. Even though we never actually call proc const with an
> expression (just with constants), I've reverted the change in r116530.
>
> Thanks for paying attention.
>
More information about the macports-dev
mailing list