Weird Language Features
Sean 'Shaleh' Perry
shaleh at valinux.com
Mon Feb 19 19:52:44 CET 2001
On Sun, Feb 18, 2001 at 01:16:49PM +0000, Dave Cross wrote:
> [Please watch the replies on this message as it's heavily
> 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?
python will throw an exception, the code could then decide that the exception
was due to a missing function and decide how to deal with it. I suspect this
could be useful in really restricted areas, but in general code it strikes me
as horribly confusing.
> 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?
perligata makes a LOT of assumptions for you. it is not really latin. I
presume it is one of the poster children for this in perl. its fun, but a toy.
even if you could code essential language words in natural language Foo, things
like if and for, there is a wealth of code out there NOT in Foo. So even if
I use perligata for the base of my code, when I use any other module I have to
be able to speak the language the module was written in. So if I try to
import a module written by your friend in French, I now have to know French to
figure out the function and variable names. As much as we hate it, a common
language is good.
As for python, the interpreter, keyword and parser are available, I suspect
this could be done with a little work.
More information about the Python-list