octave-maintainers
[Top][All Lists]
Advanced

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

Re: Matlab-compatible string class


From: Rik
Subject: Re: Matlab-compatible string class
Date: Fri, 29 Dec 2017 08:27:13 -0800

On 12/29/2017 03:41 AM, address@hidden wrote:
Subject:
Re: Matlab-compatible string class
From:
ederag <address@hidden>
Date:
12/29/2017 03:41 AM
To:
address@hidden
CC:
"John W. Eaton" <address@hidden>
List-Post:
<mailto:address@hidden>
Content-Transfer-Encoding:
7Bit
Precedence:
list
MIME-Version:
1.0
References:
<address@hidden>
In-Reply-To:
<address@hidden>
Message-ID:
<address@hidden>
Content-Type:
text/plain; charset="us-ascii"
Message:
6

On Wednesday, December 27, 2017 17:47:50 John W. Eaton wrote:
With this change:

   http://hg.savannah.gnu.org/hgweb/octave/rev/0b65949870e3

we are beginning to handle the existence of the Matlab string class that 
is now created in Matlab when double quoted strings are used.  I expect 
that it will not be too long before users will expect full compatibility 
in this area.  But I'm not sure how we will transition from Octave's 
current behavior for double-quoted string constants to the one now used 
by Matlab.  For example, in  Octave "foo\n" is a 4-element character 
array containing 'f', 'o', 'o', and a linefeed character.  In Matlab it 
is a string object, but it also contains 5 characters, 'f', 'o', 'o', 
'\', and 'n'.  I'm sure there are other differences, but this is sure to 
cause some trouble.  I don't see a smooth transition path.  Does anyone 
have any ideas about what to do?

jwe

The octave way is much smarter.
The double quote string is like a C string, very intuitive.
Changing that would be a regression, IMHO.

Could it be possible to expand escaped characters like \n
to '\', 'n' only in the --braindead mode ?

I'm also not interested in taking away good features of the Octave language.  The vision is that Octave is a superset of Matlab--it can do everything Matlab does, and then some more.  In this case, The single/double quote distinction is very familiar for anyone who has done any sort of programming, and it is also useful for making the strings more readable when they contain single quotes.

Consider,

'I can''t understand, don''t want, shan''t accept losing double quotes'
to
"I can't understand, don't want, shan't accept losing double quotes"

Of course, the devil is in the details and finding some way of accommodating string arrays will be important.

--Rik


reply via email to

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