Diab Jerius
2024-08-05 21:09:55 UTC
There is no “isnta” operator, so to determine if an object isn't in a
class, one might write
! $obj isa Class
But, this is wrong. The precedence of the ‘!’ operator binds more
closely to $obj, and this is effectively
(!$obj) isa Class
which isn’t at all correct. One must write
! ($obj isa Class)
This has bit me in the nether regions enough times that it has become
annoying. For the uninitiated, this results
in subtly broken code. For the initiated it adds parentheses which for
the lisp-less makes things more difficult to parse.
This contrast with other binary “equality” operators such as ⩵, eq,
which have negated versions, e.g. != , ne, so instead of writing
!( $x ⩵ 3)
one writes
$x != 3
In that vein, I suggest the bike sheddable “!isa”,
$obj !isa Class
Diab
class, one might write
! $obj isa Class
But, this is wrong. The precedence of the ‘!’ operator binds more
closely to $obj, and this is effectively
(!$obj) isa Class
which isn’t at all correct. One must write
! ($obj isa Class)
This has bit me in the nether regions enough times that it has become
annoying. For the uninitiated, this results
in subtly broken code. For the initiated it adds parentheses which for
the lisp-less makes things more difficult to parse.
This contrast with other binary “equality” operators such as ⩵, eq,
which have negated versions, e.g. != , ne, so instead of writing
!( $x ⩵ 3)
one writes
$x != 3
In that vein, I suggest the bike sheddable “!isa”,
$obj !isa Class
Diab