|
From: | Elias Mårtenson |
Subject: | Re: [Bug-apl] Handling of unterminated strings |
Date: | Tue, 20 May 2014 22:07:39 +0800 |
Thank you. I really appreciate it.Regards,EliasOn 20 May 2014 21:52, Juergen Sauermann <address@hidden> wrote:
Hi Blake, Elias,
OK, I changed this in SVN 278.
/// Jürgen
On 05/20/2014 07:29 AM, Blake McBride wrote:
I agree. I was surprised a couple of times when GNU APL automatically terminated a string. I don't remember APL automatically terminating strings. I think I'd rather see an error too.
Just an opinion.
Thanks.
Blake
On Tue, May 20, 2014 at 12:15 AM, Elias Mårtenson <address@hidden> wrote:
Hello Jürgen,
I know that you consider parsing unterminated strings to be a feature, but I would ask you to reconsider this.
It is my personal opinion that this causes more opportunities for confusion than potential benefits. I would like to share the latest such problem that I came across:
I was looking at how GNU APL was parsing complex numbers, and I typed the following:
⍎'2J3"
2J3
Note how I had accidentally terminated the string using a double quote instead of a single quote. This was a typo on my part.
If unterminated strings had resulted in an error, as I am proposing, I woul dhave gotten a SYNTAX ERROR (probably) and I my mistake would have been clear. Instead, it looked almost correct.
I did notice that there was a space preceding the complex number, so I did this:
8⎕CR ⍎'2J3"┌→──────┐│2J3 ┌⊖┐││ │ │││ └─┘│└∊──────┘
OK, now I was really confused. It took a while for me to figure out that I had actually been bitten by the unterminated array feature twice in a single statement: First, the input was parsed by GNU APL as ⍎'2J3"'. Then, the lamp function interpreted its argument 2J3" as 2J3"", yielding a two-element array consisting of a complex number and an empty array.
I think not giving an error in this case causes more confusion than it's worth.
Finally, when reading the evaluation sequence in section 6.1.1 of the standard, I interpret that as this is required to signal syntax-error in this situation.
Regards,Elias
[Prev in Thread] | Current Thread | [Next in Thread] |