[Laszlo-dev] Re: [Internal-Dev] don't use name="pp"
P T Withington
ptw at pobox.com
Fri Jun 3 15:14:23 PDT 2005
We kid you not. It's in the freakin' standard. Faked myself out on
this a whole bung of times. But, it sure makes for a simple
compiler. (Gee, even C didn't go for that simple.) I'd love to know
if the only reason for this was to make a simple compiler, or if
someone thought block scoping was too difficult for the target audience.
On 3 Jun 2005, at 16:58, Scott Evans wrote:
> > 'var' in js has function scope no matter where it occurs within
> > the function
>
> *hork*
>
> You're kidding!
>
>
>
>
>
> Oliver Steele wrote:
>
>> [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.
>>>>>
>> _______________________________________________
>> Laszlo-dev mailing list
>> Laszlo-dev at openlaszlo.org
>> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>>
> _______________________________________________
> Laszlo-dev mailing list
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>
>
More information about the Laszlo-dev
mailing list