bugGNU Octave - Bugs: bug #55891, "help @class/method"...

 
 

bug #55891: "help @class/method" emits an error rather than showing documentation

Submitter:  Colin Macdonald <cbm>
Submitted:  Tue 12 Mar 2019 07:43:23 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 14 Mar 2019 07:12:37 PM UTC, comment #9: 

works for me, thanks!

Colin Macdonald <cbm>
Wed 13 Mar 2019 06:59:46 PM UTC, comment #8: 

I pushed the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/236d8f52cbb3

It seems to work for me now.

John W. Eaton <jwe>
Group administrator
Wed 13 Mar 2019 05:25:17 PM UTC, comment #7: 

In https://savannah.gnu.org/bugs/?func=detailitem&item_id=47680#comment17, Julien said that "foo . bar @ baz . ola" is interpreted as command syntax, unless it is on the right hand side of an assignment operator.

Mike Miller <mtmiller>
Group Member
Wed 13 Mar 2019 05:17:06 PM UTC, comment #6: 

OK.  So I need to know in exactly what instances whitespace may appear within a superclass reference, and when to attempt to recognize command syntax.

Does "foo . bar @ baz . ola" work as a superclass reference or does it have to be "foo.bar@baz.ola"?  I added the possibility of whitespace in response to info posted here:

https://savannah.gnu.org/bugs/?func=detailitem&item_id=47680

but maybe I misunderstood.

John W. Eaton <jwe>
Group administrator
Wed 13 Mar 2019 04:46:08 PM UTC, comment #5: 

Matlab recognizes "foo @bar" as command syntax, equivalent to "foo('@bar')". The space after the first word is significant as always. I'm not sure if the rules are any different inside a classdef definition though. Is there reason to believe they would be different?

As far as the help system, it looks to me like the following all work in Matlab


help sym        %% returns help on the constructor only
help @sym       %% ditto
help sym.sym    %% ditto
help sym.disp   %% returns help on the disp method
help @sym/disp  %% ditto


Mike Miller <mtmiller>
Group Member
Tue 12 Mar 2019 05:05:23 PM UTC, comment #4: 

Oops, botched verbatim tags...  Here it is again:


What does Matlab do?  Does it accept this syntax for getting help or generally referencing methods in classes?  Or does it use some other syntax?

The conflict is that we are matching superclass identifiers (NAME@NAME) with a greedy regexp in which there may be whitespace around the "@" symbol and NAME may be of the form FOO.BAR.BAZ... and there may be whitespace around the "." symbol.  SO, that leads to the problem of trying to also recognize command syntax.  So I guess my question is really whether Matlab recognizes something like


foo @bar


as a command or errors because it looks like a superclass reference in thewrong context.

If it accepts this syntax as a command and the command line, what does it do inside a classdef method or constructor?

I'm fairly confident that it is not looking at the first word and trying to look up a symbol and decide whether it should be treated as a command or not, but who knows?

In short (well, maybe this comment could have actually BEEN shorter): WTF are the rules supposed to be?

John W. Eaton <jwe>
Group administrator
Tue 12 Mar 2019 04:48:06 PM UTC, comment #3: 

What does Matlab do?  Does it accept this syntax for getting help or generally referencing methods in classes?  Or does it use some other syntax?

The conflict is that we are matching superclass identifiers (NAME@NAME) with a greedy regexp in which there may be whitespace around the "@" symbol and NAMES may be of the form FOO.BAR.BAZ... and there may be whitespace around the "." symbol.  SO, that leads to the problem of trying to also recognize command syntax.  So I guess my question is really whether Matlab recognizes something like


foo @bar
-verbatim

as a command or errors because it looks like a superclass reference in the wrong context.

If it accepts this syntax as a command and the command line, what does it do inside a classdef method or constructor?

I'm fairly confident that it is not looking at the first word and trying to look up a symbol and decide whether it should be treated as a command or not, but who knows?

In short (well, maybe this comment could have actually BEEN shorter): WTF are the rules supposed to be?

John W. Eaton <jwe>
Group administrator
Tue 12 Mar 2019 04:03:19 PM UTC, comment #2: 

Here's a simple example using a built-in @class.


help @ftp/ascii


This succeeds on the stable branch.  On the dev branch it produces


error: superclass calls can only occur in methods or constructors



Rik <rik5>
Group administrator
Tue 12 Mar 2019 08:04:14 AM UTC, comment #1: 

It was not intentional.

John W. Eaton <jwe>
Group administrator
Tue 12 Mar 2019 07:43:23 AM UTC, original submission:  

Previously, "help @sym/assume" worked.  Now it says:


>> help @sym/assume
error: superclass calls can only occur in methods or constructors


Perhaps this is deliberate (for Matlab compat) and I should use "help sym.assume".  If so we'll need to fix #55890.

Colin Macdonald <cbm>

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by cbm (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
    2019-03-14 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-03-13 jwe StatusConfirmed Ready For Test
    2019-03-12 rik5 Summaryis &quot;help @class/method&quot; removed? "help @class/method" emits an error rather than showing documentation
    2019-03-12 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code