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.
How do you emulate a dictionary / hashtable in boo?
82 views Asked by theodox At
1
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:(You'll have to fill in the types and actual accessors yourself.)