[Laszlo-dev] Re: [Internal-Dev] don't use name="pp"
Oliver Steele
steele at laszlosystems.com
Fri Jun 3 07:08:12 PDT 2005
[Tucker has a fix, but for those of you who are curious about the js
semantics here:]
On May 27, 2005, at 5:54 PM, Adam Wolff wrote:
> wow. didn't occur to me. if you said
> var pp
>
> within the with() block, would that fix it?
If it did, that would just be indicative of another bug. 'var' in js
has function scope no matter where it occurs within the function, so
the following two programs have identical semantics:
function f() {
with (this) {
var x=1;
}
}
function f() {
var x;
with (this) {
x=1
}
}
This is weird, and it's different from C(++) and Java where f() below
has two different local variables (with the same name), and is
therefore equivalent to g():
void f() {
{int a = 1; do_something_with(a);}
{int a = 1; do_something_with(a);}
}
void f() {
int a, b;
a = 1; do_something_with(a);
b = 1; do_something_with(b);
}
But it is what it is.
> Sarah Allen wrote:
>
>> could it be this in LzNode.as, __LZresolveRefs:
>> with ( _root){
>> with( this ){
>> pp = eval( rp );
>> }
>> }
>> pp is earlier declared as a var, but doesn't with (_root) evaluate
>> it in the global context and potentially clobber anything called
>> 'pp' ?
>> Andrew McClain wrote:
>>
>>> This time i'm not crazy.
>>>
>>> <canvas>
>>> <dataset name="ds">
>>> <item value="foo"/>
>>> </dataset>
>>>
>>> <view name="pp">
>>> <edittext datapath="ds:/item/@value"/>
>>> </view>
>>>
>>> <simplelayout/>
>>> </canvas>
>>>
>>> will NOT work
>>>
>>> but
>>>
>>> <canvas>
>>> <dataset name="ds">
>>> <item value="foo"/>
>>> </dataset>
>>>
>>> <view name="notpp">
>>> <edittext datapath="ds:/item/@value"/>
>>> </view>
>>>
>>> <simplelayout/>
>>> </canvas>
>>>
>>> WILL.
More information about the Laszlo-dev
mailing list