Um, no, on this point. Implicit indexing vs explicit indexing is still ALWAYS exactly the same order.
When you use implicit ordering, say "%s %s", this is always, ALWAYS, exactly equivalent to "%1$s $2$s". The latter adds NO INFORMATION WHATSOEVER, and does not remove any ordering dependency. The order of the ordinals, and the implicit ordering, are both inextricably tied to the ordering in the code. Now, if %1$s is an adjective, and %2$s is a noun, and you translate to Spanish, you would have to reverse the order, and use "%2$s %1$s", but that translation is ALSO tied to the specific ordering in the Java code. Not using indexed substitutions in a library resources is NOT A BUG. I can't even make a decent case, despite seriously trying, for why you should even PREFER to write "%1$s %2$s" over "%s %s". The closest I can come boils down to, "it's educational!". And that leads me to the position that THIS SHOULD NOT EVEN BE A WARNING! (And yes, ALL CAPS means I AM YELLING!) The real issue here that Ecthelion is raising is that if you are mistaken about HOW a string is used, and it is not passed to String.format, and you introduce the explicit ordinals, then you have INJECTED A NEW BUG, just to shut up the resource compiler. (And if you use %n, and you shut up the resource compiler, then you have INJECTED A NEW BUG, because String.format does not support that, regardless of what the resource compiler may think!) In short, this change fixes NO bugs, but does cause or even force developers to inject new ones. I'm glad I thought to test for %1$n, rather than blindly accede to the resource compiler's demands! On Dec 9, 5:20 am, Mark Murphy <[email protected]> wrote: > On Thu, Dec 9, 2010 at 3:50 AM, Ecthelion <[email protected]> wrote: > If the developer of a library failed to use indexed substitutions, and > they somehow rely upon the implicit ordering, that is a bug in the > library, plain and simple. Like any other bug in the library, reusers > find out about it via testing, plain and simple. -- You received this message because you are subscribed to the Google Groups "Android Developers" 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/android-developers?hl=en

