|
From: | Blake McBride |
Subject: | Re: [Bug-apl] Handling of unterminated strings |
Date: | Tue, 20 May 2014 00:29:29 -0500 |
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] |