octave-maintainers
[Top][All Lists]
Advanced

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

Re: Continuation lines


From: Richard Crozier
Subject: Re: Continuation lines
Date: Wed, 03 Apr 2013 11:50:41 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1

On 03/04/2013 06:29, John W. Eaton wrote:
When was the behavior described in the bug report

  http://savannah.gnu.org/bugs/?38653

introduced in Matlab?  Has it always allowed arbitrary text after a
continuation marker (...) or is that a recent change?

It would not be hard to make this change, but if we do make the
change, then I think it would be make sense to revisit the rules for
continuation lines in Octave at the same time.

Currently, we allow ... and \ as markers, and both may have whitespace
and comments between the marker and the end of a line.  They are both
handled the same, so they can both appear inside character strings,
which now seems a little weird to me.

The original motivation for allowing backslash as a continuation
marker was that it looked like continuations in C and could be
somewhat convenient for long character strings.  So although
expressions like

  x = "foo\
bar"

look reasonable to C programmers, this is a little odd for Octave
given that \ is also the left division operator in Octave.  And
expressions like

  x = "foo...
bar"

really do not make a lot of sense to me now.  Especially not if we
allow

  x = "foo...  arbitrary text here that is treated as a comment
bar"

So what about

  * disallowing ... continuation markers in strings

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

  * deprecating and ultimately eliminating \ as a continuation marker

If we decide to make all three of the above changes, then character
strings will no longer be allowed to span multiple lines without using
some form of explicit concatenation, either with [] or cstrcat or some
other function that can join strings.

jwe


Not that recent, since at least 2008, it is so long I assumed it was an intentional difference rather than a bug.

Richard

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



reply via email to

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