# bug #59377: Command syntax could be more clearly documented

 Submitted by: None Submitted on: Wed 28 Oct 2020 07:41:59 PM UTC Category: Octave Function Severity: 3 - Normal Priority: 5 - Normal Item Group: Documentation Status: None Assigned to: None Originator Name: Originator Email: -email is unavailable- Open/Closed: Open Release: dev Operating System: GNU/Linux

You are not logged in

## Discussion

Wed 28 Oct 2020 08:40:40 PM UTC, comment #3:

The basics are documented here:
https://octave.org/doc/v5.2.0/Commands.html#Commands

And fwiw in Matlab R2020b:

>> Inf -13

ans =

Inf

>> Inf - 13

ans =

Inf

Markus Mützel <mmuetzel>
Wed 28 Oct 2020 08:34:47 PM UTC, comment #2:

OP here. I do not have Matlab, but I accept that if it's done with the aim of Matlab-compatibility that takes precedence over unexpected behavior.

Your other example with Inf did not work as described.

octave:105> Inf -13
ans = Inf
octave:106> Inf - 13
ans = Inf

Was one of them supposed to give an error?

Anonymous
Wed 28 Oct 2020 08:20:59 PM UTC, comment #1:

It's a general feature of the langauge that could probably be more clearly documented.  If you call any function using "command" syntax, like

size 12345

It is parsed and evaluated as if you had written

size ("12345")

Any update to the docs should also attempt to explain the weird rules for Matlab compatible parsing of these kinds of expressions.  For example,

Inf -13   %% => Inf ('-13') => invalid call to Inf
Inf - 13  %% => subtraction => Inf() - 13

John W. Eaton <jwe>
Wed 28 Oct 2020 07:41:59 PM UTC, original submission:

The documentation for size only lists the function-like usage "size (foo)" or "size (foo, dim)" with optional output arguments. But the following command-like syntax turns out not to give an error on Octave 7.0.0:

octave:1> size 12345
ans =
1   5

octave:2> size abcdef
ans =
1   6

Reporting this as a missed error or warning in case this behavior was not intended.

Anonymous

## Attached Files

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

Attach Files:

Comment:

No files currently attached

## Dependencies

Depends on the following items: None found

Items that depend on this one: None found

Carbon-Copy List
• -email is unavailable- added by mmuetzel (Posted a comment)
• -email is unavailable- added by jwe (Posted a comment)
•

Do you think this task is very important?
This task has 0 encouragements so far.

Only project members can vote.