octave-maintainers
[Top][All Lists]
Advanced

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

Re: stubs for missing functions


From: Jaroslav Hajek
Subject: Re: stubs for missing functions
Date: Wed, 24 Mar 2010 13:05:30 +0100

On Wed, Mar 24, 2010 at 12:04 PM, John W. Eaton <address@hidden> wrote:
> On 24-Mar-2010, Jaroslav Hajek wrote:
>
> | 1. I'm a bit sceptical that this will help. I suppose most users
> | realize that the missing functions are not implemented.
>
> My impression is that many users think their copy of Octave is broken
> in some way.  After all, they have probably read somewhere on the web
> that Octave is a "Matlab clone" so many seem to not understand that
> some things are not available.  By pointing them to an explanation of
> the situation, I'm hoping to be able to explain that it is not our job
> to provide for them.
>
> | 2. Several times when writing code compatible with Matlab I used tricks like
> | if exist ("somematlabfunc")
> |   ## Use it.
> | else
> |   ## Work it around.
> | end
> |
> | this will now be impossible.
>
> We could make exist return 0 for stub functions, but that is a bit of
> a kluge and might cause other trouble.
>
> | 4. This may give users a false impression that we eventually intend to
> | implement all of these functions, which I think is not true.
> | Some are handled by Octave forge instead, others make no sense with
> | Octave (isstudent etc.).
>
> I would certainly try to avoid giving that impression in the longer
> description on the web page.  Or, perhaps I could point to a section in
> the manual instead, so that the information is available with Octave
> and not separate on the web.
>
> | Here's an alternative suggestion:
> | Let's create a global pseudo-variable missing_function_handler that,
> | if set, will be called with the missing identifier name
> | just prior to raising an error. By default, we'll point it to an
> | m-file handler. This has several advantages:
> |
> | 1. much less code
> | 2. is configurable (relieved sigh)
> | 3. doesn't spoil tab completion or shadowing
> | 4. we can easily specialize it for certain classes of functions. We
> | can point users to OctaveForge extensions or suggest alternatives.
> | (for instance, we can write "textscan is not implemented, try using
> | textread" or "gsvd is not part of core Octave, see linear-algebra
> | package on OctaveForge"). And all this can happen in one function.
> |
> | what do you think?
>
> OK, as this has the same effect by default and several advantages, go
> ahead and check it in.
>
> Thanks,
>
> jwe
>

OK, I did so with some modifications: I encapsulated the gripe and
moved it to variables.cc so that it can be called from multiple
places. I added a call from feval. I don't think it's needed to cover
all cases where an unknown identifier may result in an error, however.
I also reformatted the message a bit and added special messages for
some functions. So now it works like this:

octave:1> a = onCleanup (@(~) dosomething)
warning:
onCleanup is not implemented. Consider using unwind_protect, which is
more versatile. For more info, type `help unwind_protect'.  Please read
`http://www.octave.org/missing.html'to find out how you can help with
contributing missing functionality.


error: `onCleanup' undefined near line 1 column 5
octave:1> missing_function_hook ("")
octave:2> a = onCleanup (@(~) dosomething)
error: `onCleanup' undefined near line 2 column 5

Feel free to add more specializations or correct existing ones. For
instance, perhaps we can comment on the gui functions and why they're
unlikely to be ever added.

This is also a good place to advertise your OctaveForge package.

-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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