octave-maintainers
[Top][All Lists]
Advanced

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

Re: warn when core functions are shadowed


From: Robert T. Short
Subject: Re: warn when core functions are shadowed
Date: Mon, 01 Feb 2010 06:55:55 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4) Gecko/20091017 SeaMonkey/2.0

Jaroslav Hajek wrote:
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.


Actually warnings drive me nuts. I am probably just anal retentive. And yes, this should probably be a command-line switch. Can you use one that is already there?

Regardless, this is a cool feature.

Bob



reply via email to

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