help-octave
[Top][All Lists]
Advanced

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

Re: overloading functions (Was: Indirect Addressing Question)


From: John W. Eaton
Subject: Re: overloading functions (Was: Indirect Addressing Question)
Date: Fri, 16 Nov 2001 10:58:55 -0600

On 16-Nov-2001, Paul Kienzle <address@hidden> wrote:

| Matlab decides what function to call based on the type of the
| first argument, which can be done reasonably cheaply and
| handles the majority of the cases.

This kind of design decision is what bugs me about Matlab, I think.
"It will work most of the time.  Users won't be too bothered when it
fails.  After all, we don't expect anyone to actually notice the
inconsistency because it will come up so infrequently."

Ugh.

| You could extend this so that if any of the arguments were of
| a user defined type, then check for a type specific function, but
| that won't scale well if there are a lot of user defined types
| around.

It would be fine and could probably even be relatively efficient if
functions had signatures (by that I mean a corresponding declaration
of the types and number of parameters they can handle; may be more
than one signature for a given function definition) and all functions
had to be loaded before they could be considered.  But that's not very
Matlab-like.  Function definitions would have to change because there
is no way to determine what types of arguments a function can accept
just by looking at it, and there could be no more implicit
autoloading.

jwe



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