Actually struggling to understand how to extend an immutable set with a class that will be a set of specific types. I am doing this to try to create a good DSL.
I would like to have a Thing class, and when you add βthingsβ together, you get a ThingSet object that extends Set.
class Thing(val name:String){ def +(other: Thing):ThingSet = new ThingSet() + other }
I just can't figure out how to create a ThingSet object. I know that I need to mix traits like GenericSetTemplate, SetLike, etc. But I just can't get it to work.
Please can someone give me some pointers as I cannot find anything explicit enough to learn. I tried to take a look at the implementations of BitSet and HashSet, but got lost.
user523071 Dec 11 '10 at 13:17 2010-12-11 13:17
source share