If you want to make a boo class that behaves like a dictionary or hashtable, what is the correct syntax? In Python you'd override __getitem__
and __setitem__
, but I've been unable to find the equivalent magic methods in Boo and I don't think I can inherit from Dictionary in this case.
If you want to adapt an existing class to act like a dictionary/hash, (or to access an internal field of one of these classes,) the equivalent to overriding __setitem__
and __getitem__
is defining a default array property on the class, like so:
public self[key as TKey] as TValue:
get:
return LookupValue(key)
set:
SetValue(key, value)
(You'll have to fill in the types and actual accessors yourself.)