Documentation for method EXISTS-KEY
assembled from the following pages:
Language documentation: Subscripts §
From Subscripts
(Subscripts) method EXISTS-KEY §
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.
Role: Associative §
From Associative
(Associative) method EXISTS-KEY §
method EXISTS-KEY(\key)
Should return a Bool
indicating whether the given key actually has a value.