This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add the `isa` operator
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>
Wed, 23 Oct 2019 18:00:38 +0000 (19:00 +0100)
committerPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>
Mon, 9 Dec 2019 23:19:05 +0000 (23:19 +0000)
commit813e85a03dc214f719dc8248bda36156897b0757
tree9e3c12a41469a967477219e0d0a670ab593618d2
parente139e9c0aa8151ab29e98bb9f3216ee7a14abe4d
Add the `isa` operator

Adds a new infix operator named `isa`, with the semantics that

  $x isa SomeClass

is true if and only if `$x` is a blessed object reference that is either
`SomeClass` directly, or includes the class somewhere in its @ISA
hierarchy. It is false without warning or error for non-references or
non-blessed references.

This operator respects `->isa` method overloading, and is intended to
replace boilerplate code such as

  use Scalar::Util 'blessed';

  blessed($x) and $x->isa("SomeClass")
33 files changed:
MANIFEST
embed.fnc
embed.h
ext/Opcode/Opcode.pm
feature.h
gv.c
keywords.c
keywords.h
lib/B/Deparse-core.t
lib/B/Deparse.pm
lib/B/Op_private.pm
lib/feature.pm
lib/warnings.pm
op.c
opcode.h
opnames.h
pod/perldelta.pod
pod/perldiag.pod
pod/perlop.pod
pp.c
pp_proto.h
proto.h
regen/feature.pl
regen/keywords.pl
regen/opcodes
regen/warnings.pl
sv.c
t/op/coreamp.t
t/op/coresubs.t
t/op/isa.t [new file with mode: 0644]
toke.c
universal.c
warnings.h