Weird Language Features

Robert Hand Robert_Hand at notspammehotmail.com
Sun Feb 18 12:09:20 EST 2001


> 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?

If you call a function that doesn't exist, I don't think it will compile.
To examine
an object and it's functions I think you use the reflection library (haven't
messed with it myself)

>
> 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?
>
This would be an application to replace strings.  Probably impossible due to
abbreviations and wierd stuff.
Unless you want to type in each translation, instead of automating it.
Java does have some neat internationalization features for replacing
messages, menu options etc.
Pretty advanced/
>
> 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.
>
Really?  Thats great!  If you can do it in perl, you can probably implement
it in java.
I'm not a perl expert.  Is the perl source code translation a function of
perl or a separate app?
if it's a separate app, handling ascii input, give me a link.

> 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 think as far as internationalization goes, java is prety mature.
Unfortunately, it's
2000 miles from me to the next non-english speaking nation.  No opportunity
to pursue it.


> 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.
nope.  I must start a flame.  I am compelled to by satan.  Bill Gates is our
savior.  All hail the great redmond giant! HAIL or be consumed! Oh come on,
please hail.  Please.  I'll give you a free copy of interdev.  I'll but your
company and give you free coca-cola.  Fine then.  If you won't praise Bill
I'll just go pout until you do....


> <http://www.dave.org.uk>  SMS: sms at dave.org.uk





More information about the Python-list mailing list