[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: why does IServiceManager:getService not return IService instead of P.L.Object

  • Thread starter Thread starter bronco
  • Start date Start date
Status
Not open for further replies.
B

bronco

Guest
Generics are meant for run compile time type checking, what you're showing is still runtime behaviour. The undo, throw is the same what you would get is the cast doesn't work out because incompatible types. Generics are handy when you use it to make sure what you put into a class is of Type T. For example: def var list as ArrayList no-undo. list = new ArrayList (). list:Add(bla). // fails on compile time if you put anything else than an IService in it. And then it would be handy to have an: def var myService as IService no-undo. myService = list:get('service_abc'). // because get returns T But only because you know (because of generics) that there are only T's in the collection.

Continue reading...
 
Status
Not open for further replies.
Back
Top