help-octave
[Top][All Lists]
Advanced

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

Re: octave and oo


From: ernst
Subject: Re: octave and oo
Date: Sun, 27 Jan 2013 16:40:10 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120825 Thunderbird/15.0

Hi Jordi,

On 25 January 2013 11:22, ernst <address@hidden> wrote:
I have the problem that i need to invoke overwritten functions.
Even worse, i want do invoke the overwritten function from within the
overwriting function.
Matlab has a huge namespace problem:

    http://abandonmatlab.wordpress.com/category/my-kingdom-for-a-namespace/
ah, I see.
The article is very interesting.
In particular, that "which -all message" can be used to find all files
defining message.
These seem *all* oct/mex and also all m-files which may define the
function message.
Also these files come in the ordering in which one overwrites the next.
But if i try this to octave, only the last function is displayed.
Is this a bug?
The behavior described for matlab would solve part of my problem.

Also if i try type for a function defined by an mfile,
this mfile is displayed literally.
Seems also not as in documentation.


What I am also interested in is whether it is possible to run an mfile
directly
like a script can be run by source.
If so, how can i pass a parameter?

The combination of 'which -all <functionname>' and direct invocation
would solve my problem.

Your suggestion using object orientation, is what i normally do.
I want to provide a mechanism to inject various kinds of number types
into octave
using a uniform wrapper class in octave.

But: This does not work for functions with empty parameter list.
E.g. I want to use rand() (defined as octfile) to define my own random
function rand()
which of course must use rand() in octave.

greetings,

ernst
Octave has to mimic this problem. There is no simple solution for you.
The only advice I an offer is to not clobber the namespace.

For your particular case, depending on what you're doing, it sounds
like you want something like polymorphism. You can use old-style
classes to accomplish this:

    http://www.gnu.org/software/octave/doc/interpreter/Function-Overloading.html

Sorry,
- Jordi G. H.



reply via email to

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