On Nov 21, 7:41 pm, Fabrizio Giudici <[email protected]> wrote: > [I like list.lookup(Decimator.class).decimate(4);]
I don't really get the benefit you're seeing from: list.lookup(Decimator.class).decimate(4); compared to: Decimator.decimate(list, 4); Both examples are: 1) Unwieldy (in the sense that, when you see it, you get the distinct feeling that you want your editor to fold some of the extraneous stuff away so you can get on with reading your source). 2) Explicitly referencing source, which is an advantage of sorts, though not enough of an improvement over implicit reference to warrant the eyesore. 3) Complicate auto-complete and other 'Uh, how did this API work again?' help. > With that syntax I can extend the functionality at will Perhaps you do not understand how extension methods work? The *USE SITE* is where the extensions are defined, so, if you have a custom sort algorithm that you prefer, you can write: import my.customcode.CoolSorter.sort extends java.util.List; instead of importing it from Collections and you'll get your particular flavour of sorting instead. The choices of either the core JDK, or the author of java.util.Collections, or the author of java.util.List, cannot force anything particular on you. In the rare case you want to mix sort flavours inside the same source file, you'll have to forego extension methods and go back to ProviderClass.methodName(object); instead of object.methodName(); - but as, at this point, the implementation source is clearly no longer a meaningless detail, this would be a good thing. In your proposed syntax, it's always there, even in the vast majority of cases where it's trivial boilerplate junking up your source. > "I prefer good design" And I prefer music that sounds good. Also, art that looks nice. I like food that tastes good too. Knock it off. --Reinier Zwitserloot -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=.
