Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2005-10-03, Steven D'Aprano schreef <[EMAIL PROTECTED]>: >> On Mon, 03 Oct 2005 13:58:33 +0000, Antoon Pardon wrote: > Declarations also allow easier writable closures. Since the declaration > happens at a certain scope, the run time can easily find the correct > scope when a variable is rebound.
If it happens at runtime, then you can do it without declarations: they're gone by then. Come to think of it, most functional languages - which are the languages that make the heaviest use of closures - don't require variable declarations. > They also relieve a burden from the run-time, since all variables > are declared, the runtime doesn't has to check whether or not > a variable is accesible, it knows it is. Not in a dynamic language. Python lets you delete variables at run time, so the only way to know if a variable exists at a specific point during the execution of an arbitrary program is to execute the program to that point. > And if you provide type information with the declaration, more > efficient code can be produced. Only in a few cases. Type inferencing is a well-understood technology, and will produce code as efficient as a statically type language in most cases. > I think language matters shouldn't be setlled by personal preferences. I have to agree with that. For whether or not a feature should be included, there should either be a solid reason dealing with the functionality of the language - meaning you should have a set of use cases showing what a feature enables in the language that couldn't be done at all, or could only be done clumsily, without the feature. Except declarations don't add functionality to the language. They effect the programing process. And we have conflicting claims about whether that's a good effect or not, all apparently based on nothing solider than personal experience. Which means the arguments are just personal preferences. Until someone does the research to provide hard evidence one way or another, that's all we've got to work with. Which means that languages should exist both with and with those features, and if one sides experiences generalize to the population at large, they alternative languages will die out. Which hasn't happened yet. > But we should decide what language features are usefull and which are > not by what some individual can or can't live without. Um - that's just personal preference (though I may have misparsed your sentence). What one person can't live without, another may not be able to live with. All that means is that they aren't likely to be happy with the same programming language. Which is fine - just as no programming language can do everything, no programming language can please everyone. Antoon, at a guess I'd say that Python is the first time you've encountered a dynamnic language. Being "horrified" at not having variable declarations, which is a standard feature of such languages dating back to the 1950s, is one such indication. Dynamic languages tend to express a much wider range of programming paradigms than languages that are designed to be statically compiled. Some of these paradigms do away with - or relegate to the level of "ugly performance hack" - features that someone only experienced with something like Pascal would consider essential. Assignment statements are a good example of that. Given these kinds of differences, prior experience is *not* a valid reason for thinking that some difference must be wrong. Until you have experience with the language in question, you can't really decide that some feature being missing is intolerable. You're in the same position as the guy who told me that a language without a goto would be unusable based on his experience with old BASIC, FORTRAN IV and assembler. Pick one of the many languages that don't require declarations. Try writing a code in them, and see how much of a problem it really is in practice, rather than trying to predict that without any information. Be warned that there are *lots* of variations on how undeclared variables are treated when referenced. Python raises exceptions. Rexx gives them their print name as a value. Other languages do other things. <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list