I don't find that ugly, it's a cool hack. What if the method were called className()?
I vote for adding such to the git repo and push to get it added upstream.
The reason why I suggested using a array of strings instead of a string (this array may well be of length 1) is that UGens will belong to multiple classes; for one thing they are UGens. The system proposed here won't detect whether or not the given object is a UGen without using a exhaustive list of UGens in the check. If all we want to do is set a .gain() then simply verifying the given object is a UGen would do. In other cases detecting that it is a STKIinstrument or Filter would be more relevant than the exact way in which the given object extends those classes. A array of strings will make the general case possible, at the expense of a slight complication of the specific case. A utility function that takes a string and a array of strings as arguments, returning true if any element in the array equals the string and false in all other cases would probably solve that. This will only become more pressing once extending UGen will become possible. Similarly I'd like to propose that .connectsTo() and .connectsFrom() be added as UGen member functions and return arrays of references to UGens. With those two things we could edit the UGen graph without being bothered by the namespace. In fact calling .connectsTo() on the dac and blackhole, then recursing would make the entire active UGen graph accessible from our code. It'd be even nicer if we could also poll those UGens for the name that they have in their local namespace, if any. You see; we can have anonymous UGens, I just discovered, this parses just fine; new SinOsc => blackhole; Yours, Kas.