Re: [lang 3] static or dynamic type checks?

2009-11-27 Thread James Carman
Are we going to keep the 2,3,4-arg versions? We have to have one that accepts Object anyway, so I guess it does keep the API a bit cleaner to not clutter it with a Map, Collection, etc. version. I really don't like instanceof in code, though. It just screams bad design. Usually it means that

Re: [lang 3] static or dynamic type checks?

2009-11-26 Thread Henri Yandell
What are the pros and cons? On Wed, Nov 25, 2009 at 9:16 PM, Paul Benedict pbened...@apache.org wrote: If we want to implement LANG-508 (Validate: add message parameter construction via elllipsis notation to speed up processing), I am really concerned with the many overloaded versions of

Re: [lang 3] static or dynamic type checks?

2009-11-26 Thread Stephen Colebourne
I'm unconvinced by this change overall. It feels like a bit of a diversion from the original purpose of the class. I think it complicates greatly what should be a really simple, no-brainer, class. I could live with a one arg addition, but want to avoid varargs and primitives: public static T T[]

Re: [lang 3] static or dynamic type checks?

2009-11-26 Thread James Carman
I just wrote a class that included... public static T T someMethod(T val) { System.out.println(Single value method!); return val; } public static T T[] someMethod(T... values) { System.out.println(Multi-value method.); return values; }

Re: [lang 3] static or dynamic type checks?

2009-11-26 Thread Paul Benedict
The purpose of var-args, at least from my vantage, is to produce detail messages that are used by java.lang.String.format. Paul On Thu, Nov 26, 2009 at 7:11 AM, James Carman ja...@carmanconsulting.com wrote: I just wrote a class that included...    public static T T someMethod(T val)    {  

Re: [lang 3] static or dynamic type checks?

2009-11-26 Thread James Carman
I understand that. My point is that if you can create two, overloaded methods (which I've shown you can do), one with one single argument and one with var-args, then you can avoid the Object[] instantiation in the single-argument case. On Thu, Nov 26, 2009 at 9:42 PM, Paul Benedict

Re: [lang 3] static or dynamic type checks?

2009-11-26 Thread Paul Benedict
James, Yes. I want to also eliminate the static types of all the overloaded methods. We don't need a version for maps, one for char sets, one for objects, one for collections, etc. We can do all those checks dynamically. This was my point of my original email. What are your thoughts on it?

Re: [lang 3] static or dynamic type checks?

2009-11-26 Thread Paul Benedict
I think we should reduce the overloading and just accept Object. From the runtime type, we can determine how to do further checks. Then, we can nicely implement 1 args, 2, args, ... and finally var-args overloads. Paul On 11/26/2009 10:49 PM, James Carman wrote: So, what you're concerned

[lang 3] static or dynamic type checks?

2009-11-25 Thread Paul Benedict
If we want to implement LANG-508 (Validate: add message parameter construction via elllipsis notation to speed up processing), I am really concerned with the many overloaded versions of #validIndex() and #notEmpty() that solely differ by static argument type: Collection, Object, Object[],