bugGNU Octave - Bugs: bug #47908, Octave:classdef-to-struct not...

 
 

bug #47908: Octave:classdef-to-struct not documented in warning_ids.m

Submitter:  None
Submitted:  Thu 12 May 2016 02:07:49 PM UTC
   
 
Category:  Documentation Severity:  2 - Minor
Priority:  3 - Low Item Group:  Documentation
Status:  Confirmed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 15 May 2016 02:31:16 PM UTC, comment #5: 

I see this as a piecemeal process.  The first step is just to put a placeholder in warning_ids which documents that a particular warning ID exists.  The second step is to properly explain what it does.

Rik <rik5>
Group administrator
Sun 15 May 2016 10:35:11 AM UTC, comment #4: 

Reading between the lines in comment #2 suggests that jwe thinks that it is not necessary to document all warnings.

I think it is important to have a clear statement of what the warning means, beyond the usually brief messages.  For example, suggesting alternative idioms to replace discouraged ones would be useful.  Even if this isn't all in one place in warning_ids.m, it should IMHO be somewhere.

I agree there is little point in entries like


'Octave:singular-matrix'
'Octave:nearly-singular-matrix'
     By default, the 'Octave:nearly-singular-matrix' and
     'Octave:singular-matrix' warnings are enabled.


but entries like


'Octave:str-to-num'
  If the 'Octave:str-to-num' warning is enabled, a warning is printed
  for implicit conversions of strings to their numeric ASCII
  equivalents.  For example,
    "abc" + 0
     => 97 98 99
  elicits a warning if the 'Octave:str-to-num' warning is enabled.
  By default, the 'Octave:str-to-num' warning is disabled.


is really useful.

Lachlan Andrew <lachlan>
Sat 14 May 2016 12:14:14 AM UTC, comment #3: 

As I posted to Octave-Maintainers recently, I'd like to overhaul the warning system.

One of the changes would be to have an enumeration of all warnings in the Octave: namespace in an enumeration.  This would mean that C code can throw warnings with a cost independent of the number of disabled IDs.  That will allow more fine-grained control over which language features a user wants to be warned about (my pet peeve being automatic broadcast).

The efficiency will become more important if we allow multiple scopes, such as "this directory", "this file", "this function", "all functions called by this function" (currently called "local"), as well as global -- as suggested at bug #36743 and bug #47687.)

The enumeration would be auto-generated from warning_ids.m, and so keeping that file in sync would be easier.  Of course, .m files would still use string IDs, and so could get out of sync.  However, it would be simple to have a tool to grep for IDs in one but not the other.

Although anyone can make up their own IDs, user warnings shouldn't be in the Octave: namespace.  I'd suggest that Octave Forge should also have its own namespace, but that may involve unnecessary incompatibility.

Note that  lastwarn ()  is only useful if one type of warning is given.  The alternative is to do what Matlab does, and list the ID when the warning is printed.  Octave currently has an unused flag for verbose warnings.

Lachlan Andrew <lachlan>
Thu 12 May 2016 10:39:10 PM UTC, comment #2: 

We would eventually like to have most, if not all, warnings associated with an ID.  Then I don't know that it will make sense for all of them to be listed in a single linear list.

Anyone can make up warning IDs for warnings in their own functions, so I don't think it is possible to have a complete list.

The usual thing to do is not worry about warning IDs until you actually run across a warning that you'd prefer to disable instead of fixing the code to avoid it.  Then you can use


[msg, id] = lastwarn ();


to find out the ID associated with the warning message.

John W. Eaton <jwe>
Group administrator
Thu 12 May 2016 10:02:09 PM UTC, comment #1: 

We try, more or less, to have warning_ids.m in sync.  I'm marking the issue report as confirmed.

On the development branch, I see that the following IDs are missing from warning_ids.m:


corefcn/regexp.cc:1499:%! warning ("off", "Octave:regexp-lookbehind-limit", "local");
corefcn/error.cc:1787:  disable_warning ("Octave:missing-semicolon");
corefcn/errwarn.cc:285:  warning_with_id ("Octave:data-file-in-path",
corefcn/file-io.cc:153:          warning_with_id ("Octave:fopen-mode",
corefcn/oct-stream.cc:2298:            warning_with_id ("octave:textscan-pattern",
corefcn/__magick_read__.cc:736:        warning_with_id ("Octave:GraphicsMagic-Quantum-Depth",
octave-value/ov-classdef.cc:1243:  warning_with_id ("Octave:classdef-to-struct",
dldfcn/audiodevinfo.cc:132:          warning ("Octave:invalid-audio-device",
dldfcn/audiodevinfo.cc:828:      warning ("Octave:audio-interrupt",
dldfcn/audiodevinfo.cc:868:    warning ("Octave:invalid-default-audio-device",
./pkg/pkg.m:319:        warning ("Octave:deprecated-option",
./path/savepath.m:173:      warning ("Octave:savepath-local",
./image/imfinfo.m:165:%! warning ("off", "Octave:GraphicsMagic-Quantum-Depth", "local");
./help/__unimplemented__.m:523:    warning ("Octave:missing-function", "%s", txt);
./linear-algebra/condest.m:236:%! warning ("off", "Octave:nearly-singular-matrix", "local");
./ode/ode23.m:176:      warning ("Octave:invalid-input-arg",


Adding these to warning_ids.m is an easy change and perfect for those who want to start contributing to Octave.  If anyone submits a changeset I will review and commit it.

Rik <rik5>
Group administrator
Thu 12 May 2016 02:07:49 PM UTC, original submission:  

in ./libinterp/octave-value/ov-classdef.cc this warning_with_id is defined:

Octave:classdef-to-struct

The function warning_ids.m does not show this warning id

I am not sure whether warning_ids.m aims to be complete.

Anonymous

 

(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 lachlan (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-27 mtmiller Carbon-CopyRemoved 80942 -
    2018-04-27 mtmiller Release4.0.1 dev
        SummaryOctave:classdef-to-struct not shown by warning_ids.m Octave:classdef-to-struct not documented in warning_ids.m
    2016-05-12 rik5 Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
    2016-05-12 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code