octave-maintainers
[Top][All Lists]
Advanced

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

Re: Continuation lines


From: Jordi Gutiérrez Hermoso
Subject: Re: Continuation lines
Date: Wed, 3 Apr 2013 10:18:49 -0400

On 3 April 2013 01:29, John W. Eaton <address@hidden> wrote:
>
> So what about
>
>   * disallowing ... continuation markers in strings

Makes sense to me...

>   * allowing ... to be followed by arbitrary text that is ignored
>     (no change for \ continuations)

Also makes sense...

>   * deprecating and ultimately eliminating \ as a continuation
>    marker

I was with you up to here. What is the problem with having two kinds
of continuation markers? Is it the difficulty of maintaining both of
them? I know that \ is also the left division operator, but I don't
think this has ever caused an actual problem. It's nice that other
programming languages that need continuation characters also use a
backslash, not just C. I am thinking of Ruby and Python. Ruby and R
also wait until they get a "complete" statement before evaluating, so
something like this would work there.

   x = 2 + ## something needs to come after this +
       3;

AIUI, the new push parser would be able to handle this now?

On the other hand, Octave has another line continuation method that
Matlab doesn't: round brackets (parens) will continue to the next line
if they're not closed. I use this method in Python for line
continuations, so if we do get rid of the backslash continuations, I
propose we substitute it with bracket continuation, e.g. replace

   x = 2 \
       + 3;

with

   x = (2
        + 3);

The only situation in which this doesn't work is when writing matrix
"literals" with []. In those cases, I suppose we would have to use ...
instead.

- Jordi G. H.


reply via email to

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