octave-maintainers
[Top][All Lists]
Advanced

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

Re: parsing commands


From: Clemens Buchacher
Subject: Re: parsing commands
Date: Sat, 18 May 2013 14:36:03 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, May 17, 2013 at 06:04:16PM -0400, John W. Eaton wrote:
> 
> For Octave, we have to decide what to do for the operators that are
> unique to Octave.  That includes all op= assignment operators, ++, and
> --.  Since Matlab does not have --,
> 
>   foo --
> 
> will be a command.  But for Octave, that could be a decrement
> operation.

The -- argument is used by some command line tools as a separator of
options and arguments, e.g. from 'info rm':

    rm -- -f

Replicating the same behavior could be useful for Octave functions,
especially if they pass on arguments to command line tools.

>From that point of view -- preceded by space should be interpreted as a
command argument rather than a decrement operator, regardless of the
following characters, i.e. including space or end of statement.

For op= assignment operator this reasoning makes less sense. And having
inconsistent behavior between op=, --, and ++ seems like a bad idea.

I think most importantly we should keep consistency between those three
at least. I can see arguments both for and against interpreting these
examples as commands:

    rm -- -f
    git-checkout --
    x -= 5;
    x ++;

I'd tend towards interpreting all of these as operators (with a syntax
error in the first example), since Octave is foremost a tool for numeric
computation and not a shell.

Clemens


reply via email to

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