In role Associative§

See primary documentation in context for method EXISTS-KEY

method EXISTS-KEY(\key)

Should return a Bool indicating whether the given key actually has a value.

In Subscripts§

See primary documentation in context for method EXISTS-KEY

multi method EXISTS-KEY (::?CLASS:D: $key)

Expected to return a Bool indicating whether or not there is an element associated with $key. This is what postcircumfix { } calls when invoked like %foo<aa>:exists.

What "existence" of an element means, is up to your type.

If you don't implement this, your type will inherit the default implementation from Any, which always returns False - which is probably not what you want. So if checking for element existence cannot be done for your type, add an implementation that fails or dies, to avoid silently doing the wrong thing.