bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] ⎕EC return values are incorrect for user-defined errors


From: Juergen Sauermann
Subject: Re: [Bug-apl] ⎕EC return values are incorrect for user-defined errors
Date: Mon, 02 Jun 2014 20:03:05 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130330 Thunderbird/17.0.5

Hi David,

thanks, I see. SVN 310.

/// Jürgen


On 06/02/2014 06:49 PM, David Lamkins wrote:
Thanks, Jüergen. SVN 307 is, I think, *almost* correct.

My reading of the IBM Reference suggests that 3⊃⎕ec should be character matrix having three rows.


On Mon, Jun 2, 2014 at 7:10 AM, Juergen Sauermann <address@hidden> wrote:
Hi David,

sorry, my fault. I hadn't read the small sentence for result=0 that
it should be ⎕EM-like. Fixed in SVN 307.

Please note that GNU APL may open execution contexts (= SI-entries) differently from
IBM APL so that sometimes error messages could differ. The error code is normally
correct, but if an error is user-defined then the error message from the user (⎕ES)
could be lost because the context generating it was closed already. In that case
the context retuns an error token (containing the error code) but the token does not
contain the entire error message.

/// Jürgen



On 06/02/2014 02:26 AM, David B. Lamkins wrote:
Hi Jüergen,

Sorry for the miscommunication.

SVN 306 does fix 2⊃⎕ec. However, 3⊃⎕ec is still incorrect.

3⊃⎕ec should be the same as what ⎕em would have been without ⎕ec in the
case where ⎕ec traps an error.

Specifically: 3⊃⎕ec should be a three-row text array in which line 1 is
the error message (which may be the text provided to a ⎕es), line 2 is
the offending line of code and line 3 is the error caret(s). This is the
same three error-message lines that would have been printed to the APL
session without the ⎕ec.

This behavior is covered elsewhere on page 280 of the IBM Reference. I
apologize for having left the `paragraph 3' reference in my first email.

On Sun, 2014-06-01 at 18:53 +0200, Juergen Sauermann wrote:
Hi David,

thanks, fixed in SVN 306.

/// Jürgen


On 05/31/2014 07:51 PM, David B. Lamkins wrote:
See the IBM Reference, page 280, paragraph 3.

When ⎕EC executes an _expression_ that signals a user-defined error, the
second and third items of the result should be the same as the
_expression_'s ⎕ET (which would be 0 1 in this case) and ⎕EM. GNU APL
returns 0 0 and 'User defined error'.

Note also that ⎕ET must not be changed by ⎕EC. GNU APL already does this
correctly.

It's not clear from the IBM Reference whether ⎕EM should also not be
changed by ⎕EC. It seems reasonable to assume that *not* changing ⎕EM is
the correct behavior; the whole point of ⎕EC is to execute an _expression_
in a controlled manner. If so, GNU APL is already correct in this
regard.


        ⎕es 'foo'
foo
        ⎕ES 'foo'
        ^
        ⎕em
foo
        ⎕ES 'foo'
        ^
        ⎕et
0 1
        ⎕ec '⎕es ''foo'''
   0  0 0  User defined error
        ⎕em












--
"Far out in the uncharted backwaters of the unfashionable end of the Western Spiral arm of the Galaxy lies a small unregarded yellow sun. Orbiting this at a distance of roughly ninety-eight million miles is an utterly insignificant little blue-green planet whose ape-descended life forms are so amazingly primitive that they still think programming in Java is a pretty neat idea."

 -- With apologies to Douglas Adams, who I like to think would have appreciated this.


http://soundcloud.com/davidlamkins
http://reverbnation.com/lamkins
http://reverbnation.com/lcw
http://lamkins-guitar.com/
http://lamkins.net/
http://successful-lisp.com/


reply via email to

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