bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Handling of unterminated strings


From: Blake McBride
Subject: Re: [Bug-apl] Handling of unterminated strings
Date: Tue, 20 May 2014 00:29:29 -0500

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


reply via email to

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