See Original text in context
method EXISTS-KEY(\key)
Should return a Bool
indicating whether the given key actually has a value.
See Original text in context
multi method EXISTS-KEY (::?CLASS: )
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.