bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Quad ES message too long


From: Juergen Sauermann
Subject: Re: [Bug-apl] Quad ES message too long
Date: Mon, 16 Apr 2018 20:56:46 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

Hi again

I have analyzed the problem and it looks like the GNU APL behavior is sort of correct even
though not very elegant. The background is this:

IBM APL2 says (see ⎕ES, page 282 in the language reference manual):

When R Is a Character Scalar or Vector: Normal APL2 error handling is initiated.
R is displayed as the error message and set in ⎕EM (error message). ⎕ET
(event type) is set to 0 1.

      ∇Z←EXPO A
[1]   ⎕ES(0=A)/'ZERO INVALID'
[2]   Z←*A
[3]   ∇

      EXPO 3

2008553692

      EXPO 0

ZERO INVALID            ⍝ ⎕EM[1;] comments by jsa
      EXPO 0            ⍝
⎕EM[2;]
      ^                 ⍝ ⎕EM[3;]

      ⎕EM
ZERO INVALID
      EXPO 0
      ^

      ⎕ET
0 1



This looks kind of nice if the arguments of the function that throws an error are reasonably small,
like the numeric scalar 0 in the IBM example. In general error messages in IBM APL consist of 3
lines:

1. an error description,
2. the code line that caused the error, and
3. a line with two carets insdicating the part of the code line that caused the error,

As can be seen in the EXPO example, in 2 the actual values (not the formal values) are being displayed.

In your example, the left argument, say A,  of the offending function tb_line is (in boxed form):

┏→━┓    ┏→━┓
┃ID┃    ┃TB┃
┗━━┛    ┗━━┛
┏→━━━━┓ ┏→━━━━━━━━━┓
┃title┃ ┃A Schedule┃
┗━━━━━┛ ┗━━━━━━━━━━┛

┏→━━━━┓ ┏→━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃lines┃ ↓┏→━┓   1 ┏→━━━━━━━━━━━━━┓      d ┏→━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓  ┃
┗━━━━━┛ ┃┃CA┃     ┃Current Assets┃        ┃1010 1110 1310 1320 1390 1410┃  ┃
        ┃┗━━┛     ┗━━━━━━━━━━━━━━┛        ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛  ┃
        ┃┏→━┓  10 ┏→━━━━━━━━━━━━━━━━━━┓ c ┏→━━━━━━━━━━━━━┓                 ┃
        ┃┃CL┃     ┃Current Liabilities┃   ┃2010 2110 2310┃                 ┃
        ┃┗━━┛     ┗━━━━━━━━━━━━━━━━━━━┛   ┗━━━━━━━━━━━━━━┛                 ┃
        ┃┏→━━┓ 11 ┏→━━━━━━━━━━━━━┓      c ┏→━━━┓                           ┃
        ┃┃LTD┃    ┃Long-term Debt┃        ┃2710┃                           ┃
        ┃┗━━━┛    ┗━━━━━━━━━━━━━━┛        ┗━━━━┛                           ┃
        ┃┏→━┓  15 ┏→━━━━━┓              c ┏→━━━━━━━━┓                      ┃
        ┃┃EQ┃     ┃Equity┃                ┃3100 3990┃                      ┃
        ┃┗━━┛     ┗━━━━━━┛                ┗━━━━━━━━━┛                      ┃
        ┗∊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

┏→━━┓   ┏→━━━━━━━━━━━━━━━━━┓
┃fns┃   ┃tb_sched_workpaper┃

┗━━━┛   ┗━━━━━━━━━━━━━━━━━━┛

That is, you get essentially 3 lines :
 

LINE NAME MUST BE A CHARACTER STRING                     ⍝ ⎕EM[1;]
A tb_line_init 'S' 40 'Sales' 'c' 5010                   ⍝ ⎕EM[2;]

^                                    ^                   ⍝ ⎕EM[3;]

except that instead of the variable name A, the value of A is printed as required
by APL2. Since A is huge and nested, the corresponding string forthe value of  A is
subject to line breaks at ⎕PW, indentation of the subsequent lines, etc.

One could think about printing A in a nicer way (e.g. boxed) but I am afraid that
would break other things because other people may evaluate ⎕EM (which gets a
copy of the offending line) in their advanced debug functions.

My proposal would therefore be that you write a defined function Quad_ES which
takes care of formatting (boxing ?) large arguments found in ⎕EM[2;] after ⎕ES has
thrown an error.

Best Regards,
Jürgen Sauermann



On 04/16/2018 05:18 PM, Bill Daly wrote:
Jürgen,

I've attached the my apl library so that you can recreate my bug if need be.

My problem is the messages generated by Quod-es:

LINE NAME MUST BE A CHARACTER STRING
      'ID' 'TB' 'title' 'A Schedule' 'lines' ('CA' 1 'Current Assets' 'd' (1010 1110 1
      310 1320 1390 1410) ' ' 'CL' 10 'Curren
      t Liabilities' 'c' (2010 211
      0 2310) ' ' 'LTD' 11 'Long-term Debt' 'c' (271
      0) ' ' 'EQ' 15 'Equit
      y' 'c' (3100 3990) ' ') 'fns' 'tb_sched_workpaper' tb_line_init 'S' 40 'Sales' 'c' 5010
^ ^
The command line that generated this was:

s1← s1 tb_line_init 'S' 40 'Sales' 'c' 5010

and the particular line in tb_line_init was:

  ⎕es (~util∆stringp 1⊃proto)/'LINE NAME MUST BE A CHARACTER STRING'


If you unpack this tarball, edit exampleSession.apl and change the )load 1 tb to find tb.apl.  You should get my message.

If this is a feature not a bug just say 'Bill, this is a feature.'

Thanx


w


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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