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

Re: Blessed objects are `isa` their reftype

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
February 18, 2021 23:33
Subject:
Re: Blessed objects are `isa` their reftype
Message ID:
20210218233324.2d9b9a75@shy.leonerd.org.uk
On Fri, 19 Feb 2021 08:12:30 +0900
Yuki Kimoto <kimoto.yuki@gmail.com> wrote:

> Sorry, I misunderstanded.
> 
> perl -e 'print( (bless [], "Foo")->isa("ARRAY")) . "\n"'
> 
> result is 1.
> 
> This is originally isa behavior.

Correct; that's how the ->isa method works.

I just don't think that's useful.

It is, at the very least, somewhat surprising. The string "ARRAY" does
not appear in the @ISA list of package Foo, nor anywhere else. No
method in such a package would be considered for method dispatch.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

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