Hello All,

So I am expanding our .isa() tests for built-in datatypes (in particular Array), and I have a few (probably very simple) questions (since I cannot seem to find details on this anywhere).

Is there an isa() built-in for this?

Or it is really @array.meta.isa() (from the Introspection section of S12)?

According to S12/Introspection, isa() does 2 things:

(NOTE: this my interpretation since the details are not speced)

- If given no arguments (only an invocant), it returns a list of the invocant's parent classes
- If given a class name as an argument, it returns a boolean (true if invocant.isa(class) and false otherwise)

Now some questions about 'class name' argument described in the second item above. (NOTE: I am asking general .isa() questions now, not just about built-ins).

I assume it can be a Class name: $fido.isa(Dog)
Or it can be a String:           $fido.isa('Dog')

But can it also be a Junction? :
        $fido.isa(Dog | Cat)    # true if $fido.isa(Dog) or $fido.isa(Cat)
        $fido.isa(Dog & Beagle) # true if $fide.isa(Dog) and $fido.isa(Beagle)

If it can be a Junction, it makes me wonder if maybe what is happening behind the scenes is not some variant of the "smart-match" (~~). In that case, then would something like this DWIM (ignoring the questionable sanity of actually doing it for a momemnt)


or even:

        @array.isa([]) # basically @array.isa(List)

However, maybe this is going to far :)

Any clarification would be much appreciated.


Reply via email to