
At 14:02 17/05/04 +0100, Jon Fairbairn wrote:
On 2004-05-17 at 09:43BST Graham Klyne wrote:
I guess that extensible syntax is great for language experiments, but I'd be concerned about it becoming a common feature of production programming.
I (the design of Ponder notwithstanding) think that too.
Is that Ponder as in access and authorization description (based on Morris Sloman's work)?
I have found that even the simple facility of user-defined operators (not including the `name` form) leads to code that is far harder to pick up and understand.
That's probably true. I've often wondered if there was a way of restricting parts of the language to use within widely available libraries (as opposed to user-defined modules). For a user to add an instance of a class, and so change the meaning of '+' is not unreasonable, but more than slight use of weird combinations of symbols surely increases the overhead when reading code.
I hypothesize (based on my own experience) that when picking up some new code, a programmer relies to a considerable extent on the mnemonic significance of the names used in the code. Non-mnemonic elements of the code must be learned and committed to memory before they can be read with any facility. This suggests that user-defined syntax (and operators) run the risk of making the task of understanding a new program more akin to learning a new programing language.
I concur. My desire to have a language with extensible syntax derives from a desire to impose some sort of consistency on additions to the language, which makes them easier to absorb when they do arrive, but it's tempered with a wish to limit the use of such facilities to places where it's really necessary. The addition of regular expressions might well be a suitable case for treatment and an argument that the current extension facilities aren't quite enough, but I wouldn't want to see too general a mechanism for the reasons you give.
I can see the utility of regexp support for a wide range of apps. And it's probably the kind of thing that really does benefit from a special syntactic form, being widely enough used to be easily recognized. Maybe where this leads is that it's fine to have means for experimental support of new syntax, but for production use there should be some broadly held consensus that the syntax is meaningful and useful. #g ------------ Graham Klyne For email: http://www.ninebynine.org/#Contact