Sure, and, for example:

typetrap=:4 :0
  try.
    x/y
  catch.
    'this is a trap'
  end.
)

   1 typetrap 1
this is a trap

Or, if you want some other kind of result (or if you want to see valid
arguments):

   +`'' typetrap i.4
6

No problem, right?

Thanks,

-- 
Raul


On Thu, Sep 21, 2017 at 8:20 AM, Erling Hellenäs
<erl...@erlinghellenas.se> wrote:
> Here J traps an exception.
>
> 1/0
>
> |domain error
>
> | 1 /0
>
> /Erling
>
>
>
> Den 2017-09-21 kl. 14:17, skrev Erling Hellenäs:
>>
>> I trap exceptions all the time in JWithATwist and I see no problems
>> whatsover with this. However I did not investigate if Windows can be
>> configured to give these exceptions so that they can be trapped, but it
>> seems highly likely, since it is a compulsory functionality in the IEEE
>> standard floating point standard./Erling
>>
>> Den 2017-09-21 kl. 14:06, skrev Raul Miller:
>>>
>>> I don't think I understand what should happen in an expression with
>>> multiple operations when we do this "J to trap the exception" thing.
>>>
>>> Language design needs to be specified so it does something for all the
>>> cases, and any "trapping of exceptions" that I can think of introduces
>>> all sorts of complexities.
>>>
>>> If you do not want those complexities, I think you should not be
>>> attempting to trap those exceptions.
>>>
>>> It's incredibly easy to express contradictory specifications.
>>> Implementing them, however, tends to be a lot more difficult (and,
>>> generally speaking, involves serious compromises).
>>>
>>> Thanks,
>>>
>>
>> ----------------------------------------------------------------------
>> 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