where is upvar

Cameron Laird claird at starbase.neosoft.com
Thu Sep 21 10:33:19 EDT 2000


In article <39C8FEAC.1668A1C4 at sage.att.com>,
Garry Hodgson  <garry at sage.att.com> wrote:
>Harald Kirsch wrote:
>> 
>> Jon Ribbens <jon+python-list at unequivocal.co.uk> writes:
>> > Accessing variables in other peoples' scopes directly is nasty anyway,
>> > use function arguments ;-).
>> 
>> Not if it is documented and if the sole purpose of a certain function
>> is to do that in a defined way. Those functions are sometimes called
>> `control structures'. It seems like Tcl is a bit ahead of Python here,
>> as it allows to create functions which look, smell and work like
>> custom made control structures.
>
>it's arguable whether this is a good thing or not.  i've used languages
>which allowed this, including tcl.  it's cute, but of limited utility.
>and the readability cost can be high.
			.
			.
			.
I've got a long speech on this topic on which I've been
working for several years.  My one-sentence summary:
more and more, I'm moving toward the Python camp that
scorns such cuteness.

On the other hand, it's not as much of a problem in Tcl
as might appear from the outside.

Here's a jumble of the main points I think need to be
understand on this score:
* [upvar] and [trace] can be considered together;
* [upvar] has two uses:  syntactic trickiness and
  introspection;
* introspection is indispensable, but probably 
  never safe in the hands of application developers;
* Python feels no shame that it can't create new
  control structures;
* Tcl gets fascinating use from [trace];
* Tcl is an interesting general-purpose computing
  language.  Python is a computing language for the
  streamlined development of applications.

I like Tcl a lot, and frequently use [upvar].  With good
discipline, it *enhances* readability.  In the wrong
hands, it's a rapid entropy-generator.
-- 

Cameron Laird <claird at NeoSoft.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



More information about the Python-list mailing list