How to create a custom slot class in Pharo

I don't understand how to create my own subclass Slot

and use it in Pharo. The problem is that it looks like the slot handling code requires me to implement #size and #index, but I have no idea what to do there.

A use case is defining a class that represents a configuration. The user can specify part of the configuration and rely on the defaults to specify the rest. For this, I want to define a slot class that has (1) a default (2) dictionary. The idea is that when a slot is read in the dictionary, a key is looked up with the name of the slot. If the key is found, then the slot value is the value found in the dictionary. If there is no key in the dictionary, the slot value will be the default.

+3


source to share


1 answer


Things are moving forward in Pharo 4, including slots. Here's an example implemented by Jan to demonstrate what you can do with slots:



https://pharoweekly.wordpress.com/2015/02/21/example-implementation-of-associations-with-slots-in-pharo-4-0/

+1


source







All Articles