dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]Different function call semantics


From: Gopal V
Subject: Re: [DotGNU]Different function call semantics
Date: Wed, 1 Jan 2003 07:39:01 +0530
User-agent: Mutt/1.2.5i

If memory serves me right, HAESSIG Jean-Christophe wrote:
> Of course it should be possible
> to "pack" all the values in an array but such a simple approach would
> be annoying when there is only one return value.

Hmm... as long as the programmer cannot see it does it really matter ?.
After all this is the job of the compiler developer or interpreter guy.
How it handles internally would matter only when we try to access these
functions from single retval stuff like C# ...

Returning a PyTuple object works for me , as long as I can index it

PyTuple tp=MyPythonFunc();
Console.WriteLine(tp[0]);

should be possible even from C# ... (though how we're going to do it
for brainf*ck is a totally different matter ;)....

And the python guy should be able to write

(a,b)=(b,a)

to swap a and b ... and this would be how it looks if converted to C#

PyTuple t1=new PyTuple(b,a); // t1=(b,a)
PyTuple t2=t1.Copy(); // or Clone() ...
a=t2[0]; // (a 
b=t2[1]; // b) 

Which though inefficent , works ... and perhaps maybe faster than direct
interpretation if done right ? ...

Btw, I never mentioned anything about my idea being ideal or optimised...
This works :-)

IMHO the biggest problem an interpreted language has is an eval() statement
which allows the modification of local variables !!... (yeah, there's not 
even an *obvious & ugly* solution for this)...

Gopal
PS: I'm using Python as a case example because there is already Jython
    which has overcome similar issues ...
-- 
The difference between insanity and genius is measured by success


reply via email to

[Prev in Thread] Current Thread [Next in Thread]