Special handling for "help" involving apostrophe?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Special handling for "help" involving apostrophe?

Daniel Sebald
Just curious if anyone is interested in altering the interpretation of
the "help" so that instead of

octave:22> help '
parse error:

   syntax error

>>> help '
          ^

the result would be the same as from

octave:22> help "'"

  -- '
      Matrix transpose operator.  For complex matrices, computes the
[snip]
      See also: .', transpose.

I don't think that is breaking anything by handling in a special way,
and it makes it a little bit more convenient for someone who is
searching for help on that operator.

In a similar fashion, if the user is interested in the help for .'
listed above, I doubt there is any use for this:

octave:23> help .'
ans =





F
o
r

h
e
l
p
[snip]

so I wonder if that help syntax interpretation could be altered as well.

Dan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Special handling for "help" involving apostrophe?

John W. Eaton
Administrator
On 07/21/2017 04:33 AM, Daniel J Sebald wrote:

> Just curious if anyone is interested in altering the interpretation of
> the "help" so that instead of
>
> octave:22> help '
> parse error:
>
>    syntax error
>
>>>> help '
>           ^
>
> the result would be the same as from
>
> octave:22> help "'"
>
>   -- '
>       Matrix transpose operator.  For complex matrices, computes the
> [snip]
>       See also: .', transpose.
>
> I don't think that is breaking anything by handling in a special way,
> and it makes it a little bit more convenient for someone who is
> searching for help on that operator.
>
> In a similar fashion, if the user is interested in the help for .'
> listed above, I doubt there is any use for this:
>
> octave:23> help .'
> ans =
>
>
>
>
>
> F
> o
> r
>
> h
> e
> l
> p
> [snip]
>
> so I wonder if that help syntax interpretation could be altered as well.

There is no special "help syntax".  It's just a function like any other
that can be called with the command syntax.  The symbol "help" may also
be a user-defined function or a variable, so you can't just do something
different if the first word in the statement is 'help'.  And since this
syntax can occur in a function, I don't see how you can do
context-dependent parsing when the statement must be analyzed before
even knowing whether the symbol "help" will refer to the built-in help
function or something else on the load path.  And doing something
different at the top-level command prompt from what happens in other
contexts seems really bad to me.

But if someone sees a way to make this work that is not overly
complicated and wants to propose a patch that doesn't break other
things, then OK, we can review it.  I just don't think there is a simple
solution.

jwe

Loading...