[Bug-apl] Quad ES message too long
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 wslib1-0-0-15-pro_tem.tgz Description: application/compressed-tar
Re: [Bug-apl] Quad ES message too long
Hi Bill, I can;t really tell what your program is doing and how the fault resp. feature can be reproduced in a simpler way. What I observed is, however, that the failed line seems to be the only one where proto is a character scalar: Working lines (first example only): s1←tb_sched_init 'TB' 'Trial Balance' JSA: proto is: ┏→━━┓ ┃┏→━┓ 1 ┏→━┓ d 1010 1110 1310 1320 1390 1410┃ ┃┃CA┃ ┃Current Assets┃ ┃ ┃┗━━┛ ┗━━┛ ┃ ┗∊━━┛ JSA: 1⊃proto is: ┏→━┓ ┃CA┃ ┗━━┛ JSA: util∆stringp 1⊃prot is: ┏→┓ ┃1┃ ┗━┛ Failed line: s1← s1 tb_line_init 'EQ' 15 'Equity' 'c' 3100 3990 JSA: proto is: ┏→━━┓ ┃S 40 ┏→┓ c 5010┃ ┃ ┃Sales┃ ┃ ┃ ┗━┛ ┃ ┗∊━━┛ JSA: 1⊃proto is: ┏━┓ ┃S┃ ┗━┛ JSA: util∆stringp 1⊃prot is: ┏━┓ ┃0┃ ┗━┛ 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 ^ ^ Are you sure that that is intended? Best Regards, /// Jürgen 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 signature.asc Description: OpenPGP digital signature
Re: [Bug-apl] Quad ES message too long
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 'L