octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #63782] "help myfunc" issues a warning if myfu


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #63782] "help myfunc" issues a warning if myfunc code has a problem
Date: Fri, 10 Feb 2023 10:44:24 -0500 (EST)

Follow-up Comment #1, bug #63782 (project octave):

I'm almost certain that this problem has been reported before but I can't find
the bug report now.

It would be fine to change Octave's way of extracting docstrings from function
files to avoid this behavior.

The current behavior happens because Octave finds the docstring and stores it
along with the function definition when the function is parsed.  That was all
implemented a long time ago and it seemed easiest to have the help function
just try to load the named function and then return the docstring that was
stored with the parsed function.  You don't see the warning the second time
because the function doesn't need to be parsed again.  The docstring is
already available from the internal table of functions.

Fixing this is not as easy as just grabbing the first block of comments from a
file.  Individual classdef methods can have docstrings, so at least for those,
you really may need to parse the entire file.  And we need to have the parser
store help text for functions entered at the command line.  Maybe we could
have the help function return the docstring from the function table if it is
available and if not, invoke the parser in a special way so that it stops
parsing once the docstring is found, suppresses diagnostic messages, and
doesn't store the function definition (so diagnostic messages will be
displayed when the code is actually parsed to be executed).


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63782>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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