Object addTrait should require at least one argument.
This reduces confusion about the behavior of "Foo addTrait". If someone really wants to add nil as a trait to Foo, it should be done explicitly. Reviewed by jer.
|@@ -1,5 +1,7 @@|
|//doc Object addTrait Takes another object, whose slots will be copied into the receiver. Optionally takes a second argument, a Map object containing string -> string pairs, holding conflicting slot names and names to rename them to. I.e., if you have two objects A and B, both have a slot named foo, you issue A addTrait(B, Map clone atPut("foo", "newFoo")) the value of B foo will be placed in A newFoo.|
|Object addTrait := method(obj,|
|+ if(call message arguments size == 0,|
|+ Exception raise("addTrait requires at least one argument"))|
|resolutions := call evalArgAt(1)|
|if(resolutions isNil, resolutions = Map clone)|