Really struggling to figure out extending the immutable Set with a class that will represent a Set of concrete type. I'm doing this to try and create a nice DSL.
I'd like to have a class Thing, and when you add 'things' together you get a ThingSet object, which extends Set.
class Thing(val name:String){
def +(other: Thing):ThingSet = new ThingSet() + other
}
I just can't figure out how to make the ThingSet object. I know I need to mix in traits like GenericSetTemplate, SetLike etc. But I just can't make it work.
Please, can anybody give me some pointers, as I can't find anything explicit enough to learn from. I've tried looking at the BitSet and HashSet implementations, but get lost.
this
to theThingSet
, so you might want to fix that bug. :-) – Hoopes