J
jankeir
Guest
Something like this should work: method public getService ( ): find first ttservice where get-class(ttservice.service).isA(T) no-error. if avail ttservice then return cast( ttservice.service , T). else undo, throw.... end. What's the point of the generics if you still need to cast? The point is that you only need it once in a single place where you can add rigorous type checks and testing instead of polluting all your code on every call. Mike, as said, you should be able to modify the type, ie in the call for cases of inheritance and such, but assuming that inheritance is not overused, I expect that to be needed only in the exception rather than the general case.
Continue reading...
Continue reading...