[Top][All Lists]

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

Re: Matlab-compatible string class

From: John W. Eaton
Subject: Re: Matlab-compatible string class
Date: Fri, 29 Dec 2017 16:31:51 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 12/29/2017 03:58 PM, Daniel J Sebald wrote:
On 12/29/2017 07:22 AM, John W. Eaton wrote:
On 12/29/2017 06:41 AM, ederag wrote:

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

No, we've been down that path before and we won't do it again.  It makes it too difficult to write code that will just work if the meaning of the language can change based on some option.  What happens when you pass your code that requires "\n" to mean LF to someone who uses Octave with --braindead?

Could make such an option software settable, e.g.,

interpconfig('-stringtype', 'escape');

That avoids the command-line configuration option, but interpconfig() function wouldn't be backward compatible; not the most egregious problem though.  It would be something like:

if (compare_versions(version(), "4.4.0", ">="))
   interpconfig('-stringtype', 'escape');

That would be fairly backward compatible, I would think.

In some sense, the above is analogous to the "tex" setting of graphics text:

octave:45> get(get(gca,"title"), "interpreter")
ans = tex

With that in mind, a alternate approach would be to add such an option to all the functions that use strings.  That is, leave the interpretation/use of the string to the very last moment.  How to display such strings at the command line (i.e., escape or non-escape) is arbitrary I suppose then, but how important that is, I don't know.

No, it is no good to have some kind of option that controls this kind of behavior. It means that I can't write a function that uses a backslash escape sequence unless I first ensure that it works the way I want.

Really, we don't want this. We already did this experiment with many other user-configurable settings that affect the way the language works and we spent literally years removing all of them. The configuration options that remain affect things like output that don't matter so much.


reply via email to

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