Yep.  Javascript's totally botched and unusable 'with' statement is an
excellent warning of what horrors that kind of thing can wreck in a
dynamic language unless carefully designed.  I also agree that .foo is
a good disambiguation syntax -- unfortunately it doesn't disambiguate
among *nested* with-blocks; maybe one should use multiple dots for the
purpose, i.e.

  on a:
    on b:
      .foo = 23

would assign to b.foo, while

  on a:
    on b:
      ..foo = 23

would assign to a.foo ...?

Disambiguation might be required only for assignment, maybe -- with
all other accesses to identifiers without leading dots doing nested
lookup (so that e.g. "print foo" might emit b.foo if present, else
a.foo if present, else local foo if present, else global foo if
present).

I'm not sure I like this whole arrangement, but maybe overall I do,
perhaps +0 ...


Alex


On Sat, Jun 14, 2008 at 7:43 AM, Phillip J. Eby <[EMAIL PROTECTED]> wrote:
> At 08:19 AM 6/14/2008 +0200, Cesare Di Mauro wrote:
>>
>> Assignament must work on the object's namespace, of course:
>>
>> def foo(a):
>>  on a:
>>     x += 1
>>     print x
>>    will be equivalent to:
>>
>> def foo(a):
>>  a.x += 1
>>  print a.x
>
> Er, you need a syntactic disambiguation here to distinguish attributes from
> locals or globals:
>
> def foo(a):
>  on a:
>     .x += 1
>     print .x
>
> Otherwise, this leads to all sorts of craziness.  You'd also have to
> restrict what could be referenced in a nested "on" block, in order to avoid
> further ambiguities.
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/aleaxit%40gmail.com
>
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to