Raku (Perl 6) Type System

I’ve just discovered a bit of prior art for this, in the form of Raku (i.e., the language formerly known as Perl 6). Its equivalent to TYPE OF, namely WHAT, returns only the ‘type object’ of which the value is an instance. By contrast, type matching (and pattern matching) is done using ACCEPTS with a signature literal, which is a much more flexible syntax allowing all kinds of constraints to be expressed.

Actually, now that I think of it, Raku signature literals strike me as quite a nice approach. For Ren-C, they suggest the idea of having a ‘type-matching dialect’… though, then again, I guess that’s something I already suggested above.