bugGNU Octave - Bugs: bug #43815, ["ab" 99] produces...

 
 

bug #43815: ["ab" 99] produces single-quoted string 'abc'

Submitter:  Rik <rik5>
Submitted:  Sun 14 Dec 2014 12:59:00 AM UTC
   
 
Category:  Interpreter Severity:  2 - Minor
Priority:  5 - Normal Item Group:  None
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 16 Dec 2014 04:35:42 AM UTC, comment #3: 

I don't see much utility in the feature, and if someone comes along who needs it they can attempt to justify it, or pay to have it implemented.

I'm marking this as "Won't Fix" and closing the report.

Rik <rik5>
Group administrator
Mon 15 Dec 2014 10:34:40 PM UTC, comment #2: 

Rik, you are right that the only way a double-quoted string is supposed to be created is if all the parts that are concatenated are double-quoted strings.  I think that's OK and probably doesn't need to change.

We have to allow concatenation of ASCII numeric values with single-quoted strings for Matlab compatibility.

I suppose we could disallow concatenation of ASCCI numeric values with double-quoted strings, since that won't cause trouble for Matlab compatibility.  What do you think?  Does anyone really need that feature?

John W. Eaton <jwe>
Group administrator
Mon 15 Dec 2014 04:35:55 AM UTC, comment #1: 

The relevant code is in pt-mat.cc in routine tree_matrix::rvalue1.

The default is a single-quoted string unless absolutely all strings are double quoted strings.  See below.


char type = all_dq_strings_p ? '"' : '\'';


It doesn't seem like this is particularly worth fixing.

Rik <rik5>
Group administrator
Sun 14 Dec 2014 12:59:00 AM UTC, original submission:  

This is just an oddity, and I'm not sure it has any relevance.

When concatenating a double-quoted string with a number the result is a single-quoted string.  However, I suspect the rationale is that double-quoted string + ! double-quoted string = single-quoted string.

Thus, adding a single-quoted string, or a number counts as a non-double-quoted string and the result is therefore a single-quoted string.


octave:1> x = ["ab" 99]
x = abc
octave:2> is_dq_string (x)
ans = 0


Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-12-16 rik5 StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code