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 08:44:36 +0100

On Wed, Mar 24, 2010 at 7:53 AM, Jaroslav Hajek <address@hidden> wrote:
> On Tue, Mar 23, 2010 at 11:33 PM, John W. Eaton <address@hidden> wrote:
>> We frequently see people sending bug reports or questions on the help
>> list about functions that are available in Matlab but missing from
>> Octave.  I think we could avoid many of these problems with the
>> attached patch.  The idea is that for every core Matlab function that
>> we know about that is missing from Octave, we create a simple stub
>> function which when run fails with the error:
>>
>>  error: The FCN function is not yet implemented in Octave.  Please read
>>  `http://www.octave.org/missing.html' to find out how you can help to
>>  contribute a working version of this function.
>>  error: called from:
>>  ...
>>
>> Likewise, if someone asks for help about one of these functions, they
>> will get the following help text:
>>
>>  `FCN' is a function from the file .../FCN.m
>>
>>   -- Function File:  FCN ()
>>       This function is not yet implemented in Octave.  Please read
>>       `http://www.octave.org/missing.html' to find out how you can help
>>       to contribute a working version of this function.
>>
>> (In both cases, FCN will be replaced by the actual function name).
>>
>> The referenced web page, http://www.octave.org/missing.html remains to
>> be written.  I intend to explain that there are several possible
>> reasons why the function is missing:
>>
>>  The function may exist in Octave Forge but has not yet been adopted
>>  as a part of the core Octave distribution.
>>
>>  The function may be new to Matlab.  Perhaps the Octave community
>>  has no knowledge of it.
>>
>>  Octave is developed by volunteers who tend to contribute the
>>  functions which they need, and so far no one has contributed a
>>  version of this function.
>>
>> My advice will be something like
>>
>>  1. check Octave Forge, as a similar function may be available there.
>>
>>  2. consider writing a function and contributing it.
>>
>>  3. consider paying someone to implement the function for you.
>>
>>  4. file a feature request in the bug tracker.
>>
>> Comments?
>>
>> Are there any objections to committing this patch?
>>
>> Thanks,
>>
>> jwe
>>
>>
>
>
> Besides Soren's comments, I have a couple more:
>
> 1. I'm a bit sceptical that this will help. I suppose most users
> realize that the missing functions are not implemented.
> 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.
> 3. I am almost sure when implementing new functions I will forget to
> delete them from the list. (Not that this is serious :)
>
> 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.).
>
> 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?
>

Attached is a suggested patch. I started from John's list (deleted
things like varargout), which should serve as a fallback, but anyone
is welcome to add more specific, descriptive messages for certain
classes of functions.
I'll add some myself unless there are objections to this patch.

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

Attachment: missing.diff
Description: Text Data


reply via email to

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