Conversion?

Dear J experts: Trying to understand conversions and promotions. How would one set an autoconversion so that a Bool-eable type becomes Bool when Bool is requested. I.e., that the following would work?

if (1) "ok" end

convert(Bool, 1) already works, but it is not invoked. Why does the 1 not get converted to a Boolean on request of a Bool? This is not important. I just want to learn whether this is a core facility that I am not aware of, or simply better not done.

(I understand the promotion rule of [1, true] sensibly yields [1,1].)

That’s not allowed.

2 Likes