help-octave
[Top][All Lists]
Advanced

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

Re: Realtime cost of call by value


From: Glenn Golden
Subject: Re: Realtime cost of call by value
Date: Sat, 01 Nov 2003 11:31:09 -0700

"John W. Eaton" writes:
>
> Similar to C++, I think the notion of a reference argument should be a
> property of the function definition, not the code that calls the
> function.  So we would write something like
> 
>   function F (reference A)
>     ...
>   endfunction
> 
>     .
>     .
>     .
>

I like it a lot.  Syntactically clean,  flexible w.r.t. conciseness
("&" and even perhaps "ref" could be overloaded on "reference"),
and yet requires no user MatLabotomy.  For those that don't even
want to know to spell "call by reference", it seems like it would
be totally ignorable, nothing new needs to be learned.  This also
makes it possible to cleanly partition the documentation in the user
manual too: Discussion of references could almost be a separate,
optionally-readable subsection: "Using references: How to make your
Octave code more efficient".

A small point perhaps, but when new people come on board either
from scratch or from Matlab, I suspect that they usually want to
just get on the air quickly, solve their problem, and not have to
learn about computer science.  This has been my consistent experience
with most colleagues in my line of work. And yet, if they find out
later that call by value is eating their lunch, _then_ they can go
read about references to speed things up.

The only issue I can think of with the "property of the function, and
not the calling code" paradigm is that it seems vaguely like it might
create a need for prototyping/declaring forward function refs, so that
the interpreter knows how to call them. And similarly, seesm like
could have some implications for feval(). But I may be totally off
base with this, I don't really understand how that stuff works, it's
just something that occurred to me as a possible issue when I started
to think about how I might use it.

Executive summary:  Great idea. This capability would go a long way
toward allowing Octave to be more realtime efficient for those that
need it to be, yet in a clean way, without affecting those that don't.

Glenn



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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