Perhaps using try. and catch. misled the discussion as it was dealing with
an error in the definition. Instead consider

f=:3 : 0
if. 0=3!:0 y
  do.   +:y
  else. 'y is not an integer'(13!:8)123
end.
)

I know, a silly example. Here f is intended to only take integer arguments.
There is no error in the definition. The error is in the statement invoking
f by trying to use it in a way not intended. Just like + reports a domain
error for a non-numeric argument, not in the definition of +, but in the
statement envoking + . I see (13!:8) as a way for users to report an error
in the way an explicit definition is being used.

On Tue, May 31, 2016 at 9:15 AM, Henry Rich <henryhr...@gmail.com> wrote:

> [Better late than never]
>
>   13!:8 itself creates an error.  Here, everything was going along great:
> +y failed, but the error was caught, and it was all going to be OK until we
> crashed on 13!:8.  So as far as the JE is concerned, the 13!:8 line IS
> where the error is.  A try. in an earlier verb might trap it.
>
>   A reasonable change would be this: if error-text is given for 13!:8,
> that text becomes the entire error-massage, and 13!:8 will not add the
> 13!:8 line too.
>
>   That would leave you responsible for seeing what line failed, which you
> can do with 13!:12'' before executing 13!:8.  13!:8 isn't going to be able
> to point to the failing line.
>
>   Comments, please.
>
> Henry Rich
>
> On 5/18/2016 12:10 PM, Don Guinn wrote:
>
>> It has always bugged me that debug signal message is not correct. Now that
>> the J source is open for suggestions for changes I would like to suggest a
>> change to the message.
>>
>> Given:
>>
>>      f
>>
>> +-+-+------------------------------------+
>>
>> |3|:|try.  +y                            |
>>
>> | | |catch. 'y is not numeric.'(13!:8)123|
>>
>> | | |end.                                |
>>
>> +-+-+------------------------------------+
>>
>>     'First', f 'Last'
>>
>> |y is not numeric.
>>
>> |   'y is not numeric.'    (13!:8)123
>>
>>     'First', + 'Last'
>>
>> |domain error
>>
>> |   'First',    +'Last'
>>
>>
>> Notice that the second error message shows the caller's line in error, not
>> the line issuing the message. It would be more meaningful if the display
>> were:
>>
>>     'First', + 'Last'
>>
>> |y is not numeric.
>> |   'First',    f'Last'
>>
>> Granted, if debug were on then the suspension and message should be as it
>> is now, but when it is off using the line from the caller makes more
>> sense.
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to