[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: warn when core functions are shadowed
From: |
Jaroslav Hajek |
Subject: |
Re: warn when core functions are shadowed |
Date: |
Mon, 1 Feb 2010 15:48:38 +0100 |
On Mon, Feb 1, 2010 at 3:06 PM, Robert T. Short
<address@hidden> wrote:
> Jaroslav Hajek wrote:
>>
>> hi all,
>>
>> attached is a patch that enables Octave to issue a warning when core
>> library or built-in functions are shadowed by user functions after
>> addpath ().
>> This may help users avoid unexpected failures (and subsequent false
>> bug reports) caused by name clashes from their own functions or
>> functions from packages (primarily old versions of packages that
>> sometimes contains functions subsequently implemented or moved to
>> core. This has bitten me more than once.)
>>
>> So now we'll see warnings like this:
>>
>> warning: function ./accumarray.m shadows a core library function
>> warning: function /home/hajek/octave/nth_element.m shadows a built-in
>> function
>>
>> Enabling the warning also for files from "." was a bit tricky, because
>> the "." directory was being treated in a complicated way, added
>> multiple times.
>> I modified things a bit, hope I didn't screw anything up.
>>
>> Currently the warning is hard-wired. Should it be configurable?
>> Note that to test the patch you need to install the built binary,
>> because run-octave adds the system path through command line params.
>>
>> Comments? OK to push?
>>
>>
>
> This is a very good thing, but the user should be able to turn it off. I
> frequently shadow core functions intentionally - usually because of a
> problem in the core such as the slow scatter plot thing we discussed
> recently - but the user should always have the option of shadowing any
> function.
>
> Bob
>
Well, the shadowing isn't disabled, you just get a warning. When doing
power-user tricks, you probably don't mind ignoring a few warnings.
The problem with configuration is that it should probably be done
through a command-line switch, because some of these warnings will
occur prior to reading your octaverc.
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- warn when core functions are shadowed, Jaroslav Hajek, 2010/02/01
- Re: warn when core functions are shadowed, Dupuis, 2010/02/01
- Re: warn when core functions are shadowed, Robert T. Short, 2010/02/01
- Re: warn when core functions are shadowed,
Jaroslav Hajek <=
- Re: warn when core functions are shadowed, Robert T. Short, 2010/02/01
- Re: warn when core functions are shadowed, John W. Eaton, 2010/02/01
- Re: warn when core functions are shadowed, Jaroslav Hajek, 2010/02/02
- Re: warn when core functions are shadowed, John W. Eaton, 2010/02/02
- Re: warn when core functions are shadowed, Jaroslav Hajek, 2010/02/02
- Re: warn when core functions are shadowed, John W. Eaton, 2010/02/02
warn when core functions are shadowed, John W. Eaton, 2010/02/01