bugGNU Octave - Bugs: bug #57814, [octave forge] (NaN) "shadows...

 
 

bug #57814: [octave forge] (NaN) "shadows core function" warnings when loading package

Submitter:  Andrew Janke <apjanke>
Submitted:  Sat 15 Feb 2020 03:02:31 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 5.2.0 Operating System:  * Mac OS
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 23 Jul 2021 09:09:18 PM UTC, comment #4: 

As the maintainer of the NaN-package, I want to reply to these two comments;

comment #1:

> I think that is the expected behavior of the NaN package. The intent is to provide replacements of core functions that have different behavior under the presence of NaN values.


and

https://octave.discourse.group/t/so-many-warnings-upon-loading-nan-package/400

> For some reason the package maintainer did not choose to fix a reported bug about this issue. (this comment links to this bug #57814)



Here is my response to these two comments:

It is correct, that the intend of the NaN-toolbox is to modify the behaviour of serveral statistical functions w.r.t. how NaNs are handled in these functions. When the NaN-toolbox initially developed, installing these functions did not cause warnings in Octave. Only at some later time, Octave started to issue warnings. So these kind of warnings were caused by the maintainers of Octave. And I must assume that this was done intentionally.
 
IMO, the preferred solution would be that all statistical functions handle NaN's gracefully, and just ignore NaNs. But I've received clear response that such patches would not be accepted for the sake of "compatibility" to Matlab. I'd say doing the "right thing" (i.e. skipping NaNs) trumps the argument of some braindead "compatibility to Matlab". But the maintainers of Octave do not agree. I guess that's the main dispute here. Other issues that were mentioned  are:
- coding style (that these should be easily solvable)
- performance (this issue is mostly mute, because we are usually memory-bandwith limited, not cpu-limited - in most cases there is no performance penalty.
- the corner case of mean - which might be also used in a non-statistical context (when propagating NaNs is the right thing to do, e.g. computing the center of a triangle). I'm not aware that any other statistical function could be used in a meaningful way in a non-statistical context. And I'm sure we can also find some solution for mean.

What remains is the question whether "gracefully handling NaNs" or some braindead "compatibility" issue is more important. I and the users of the NaN-toolbox have already made up their mind on this - despite these scary warnings. 

Addressing the issue of these (false) warnings can not be done from within the NaN-toolbox alone, but there need to be an agreement on a wider basis. Only then this issue is "solvable".


Alois Schlögl <schloegl>
Sat 15 Feb 2020 08:44:52 PM UTC, comment #3: 

I see, I can reopen, but I'm not sure this is solvable.

Part of the expectation of PKG_ADD is that the directory has already been added to the load path when the content runs. So by the time PKG_ADD would be able to do something, the warnings have already been issued.

I think this would require some new marker in the directory that Octave's load-path functions would handle internally, for example a .nowarn file or something. And I'm not sure that's something we'd want to handle in Octave.

Mike Miller <mtmiller>
Group Member
Sat 15 Feb 2020 08:38:26 PM UTC, comment #2: 

Sorry, the rest of my post got lost due to an unclosed "verbatim" tag.

What I mean is, yeah, I agree that this is intended behavior. And since it's working as intended, perhaps the warnings should be suppressed? They don't indicate anything going wrong, and no user action is required, so IMHO they shouldn't be displayed to the user.

This is what I see:


octave:2> pkg load nan
warning: function /Users/janke/octave/nan-3.4.5/mad.m shadows a core library function
warning: called from
    load_packages_and_dependencies at line 48 column 5
    load_packages at line 47 column 3
    pkg at line 461 column 7
warning: function /Users/janke/octave/nan-3.4.5/prctile.m shadows a core library function
warning: called from
    load_packages_and_dependencies at line 48 column 5
    load_packages at line 47 column 3
    pkg at line 461 column 7


and when I see something like that, I assume something's going wrong that I need to address.

Maybe a little magic in PKG_ADD could be used to temporarily disable the "shadows core function" warning while the nan package is adding its stuff to the path?

Andrew Janke <apjanke>
Sat 15 Feb 2020 08:35:11 PM UTC, comment #1: 

I think that is the expected behavior of the NaN package. The intent is to provide replacements of core functions that have different behavior under the presence of NaN values.

Mike Miller <mtmiller>
Group Member
Sat 15 Feb 2020 03:02:31 AM UTC, original submission:  

When I load the nan Octave Forge package, I get several warnings about it shadowing core library functions.


octave:4> pkg load nan
warning: function /Users/janke/octave/nan-3.4.5/mad.m shadows a core library function
warning: called from
    load_packages_and_dependencies at line 48 column 5
    load_packages at line 47 column 3
    pkg at line 461 column 7
warning: function /Users/janke/octave/nan-3.4.5/prctile.m shadows a core library function
warning: called from
    load_packages_and_dependencies at line 48 column 5
    load_packages at line 47 column 3
    pkg at line 461 column 7
warning: function /Users/janke/octave/nan-3.4.5/ranks.m shadows a core library function
warning: called from
    load_packages_and_dependencies at line 48 column 5
    load_packages at line 47 column 3
    pkg at line 461 column 7
+verbatim+

Since these are expected and intentional, could the warnings be suppressed, maybe with a little magic in PKG_ADD in the package?

Andrew Janke <apjanke>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by schloegl (Posted a comment)
  • -email is unavailable- added by apjanke (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-02-15 mtmiller StatusInvalid / Not an Octave Bug Confirmed
        Open/ClosedClosed Open
        Summary&quot;shadows core function&quot; warnings when loading nan package [octave forge] (NaN) "shadows core function" warnings when loading package
    2020-02-15 mtmiller StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code