Weird Language Features
dave at dave.org.uk
Sun Feb 18 08:16:49 EST 2001
[Please watch the replies on this message as it's heavily
I'm doing some comparisons on programming language features and I'd be
very interested to know how you would handle the following scenarios
in your programming language of choice.
1/ The programmer calls a function that doesn't actually exist within
the application (or libraries). Is the a feature whereby the
programmer can create a "catch-all" function which is called in cases
like these? Can this function examine the list of existing functions
and call the most appropriate one? Or create a new function on the fly
and install it into the application?
2/ Can ou filter the input source code before compilation (or
interpretation) in some way so that language keywords could be changed
for other strings? Imagine you wanted to allow someone to program your
language of choice in, say, French. How would you go about translating
French keywords into ones that the compiler (or interpreter) could
understand. What if the translation wasn't one-to-one or fixed? Could
you put enough intelligence into the translator so that it could
handle certain strings differently depending on where they appeared in
the source code?
If you're wondering why I'm inventing these bizarre scenarios, it's
for a paper I'm writing for this year's Perl Conference. Perl does
have these features (see the AUTOLOAD function and source filters) and
I'm interested in seeing how widespread they are in other languages.
Of course, if you'd like to tell me just why you consider it's a good
thing that your language of choice doesn't have these features, then
I'd be only too happy to hear that too.
I'd just like to make it clear that I'm not interested in getting into
"my language is better than your language" types of flamewars. I'm
certainly not trying to argue that Perl is better than other languages
for having these features.
Thanks for your time.
<http://www.dave.org.uk> SMS: sms at dave.org.uk
More information about the Python-list