develooper Front page | perl.perl5.porters | Postings from February 2021

Re: Blessed objects are `isa` their reftype

Thread Previous | Thread Next
From:
Tom Molesworth via perl5-porters
Date:
February 16, 2021 23:15
Subject:
Re: Blessed objects are `isa` their reftype
Message ID:
CAGXhHdmLB9MB1wxvJ7v9M=FGWC3+GBqA0VB41fbz3AsJ7+MgWw@mail.gmail.com
On Wed, 17 Feb 2021 at 07:10, David Christensen <dpchrist@holgerdanske.com>
wrote:

> On 2021-02-16 14:57, David Christensen wrote:
> > On 2021-02-16 14:19, Paul "LeoNerd" Evans wrote:
> >> On Tue, 16 Feb 2021 14:05:16 -0800 David Christensen wrote:
> >>> On 2021-02-16 13:17, Dan Book wrote:
> >>>> On Tue, Feb 16, 2021 at 4:14 PM David Christensen wrote:
> >>>>> On 2021-02-16 04:09, Paul "LeoNerd" Evans wrote:
> >>>>>> There is an odd asymmetry with isa when testing if an object is
> >>>>>> derived from its reference type:
> >
> >>    $ perl5.32.1
> >>    use feature 'say';
> >>    use experimental 'isa';
> >>
> >>    my $aref = [ 1, 2, 3 ];
> >>    say "1.TRUE" if $aref isa ARRAY;
> >>
> >>    my $aobj = bless [ 5, 6, 7 ], "MyArray::Class";
> >>    say "2.TRUE" if $aobj isa MyArray::Class;
> >>    say "3.TRUE" if $aobj isa ARRAY;
> >>    ^D
> >>    2.TRUE
> >>    3.TRUE
> >>
> >> The one numbered 3 is surprising.
> >
> > Where is the specification for 'isa'?  I do not see 'isa' in the
> > documentation for 'experimental':
> >
> >      https://perldoc.perl.org/experimental
>
> 'isa' is now a feature:
>
> https://perldoc.perl.org/feature#The-'isa'-feature


Yes, "experimental" does two things:

- enables a feature
- disables the experimental warning for that feature

but does not implement or document (in detail) any of the features itself.

The latest 0.22 version on CPAN mentions "isa":

https://metacpan.org/pod/experimental

but core 5.32.0 has the older 0.20 version.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About