Return-Path: Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 97373 invoked from network); 9 Sep 2003 12:51:05 -0000 Received: from unknown (HELO mail.adeptra.com) (195.167.183.58) by daedalus.apache.org with SMTP; 9 Sep 2003 12:51:05 -0000 Received: from optonline.net [67.86.6.52] by mail.adeptra.com with ESMTP (SMTPD32-6.05) id ACB428AC03A8; Tue, 09 Sep 2003 13:51:00 +0100 Date: Tue, 9 Sep 2003 08:51:13 -0400 Subject: Re: [jexl] size method unit test failing Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) Cc: Jakarta Commons Developers List To: tobrien@discursive.com From: Geir Magnusson Jr. In-Reply-To: <1063110301.5883.41.camel@ob1desktop.discursive.com> Message-Id: <4B1CA35F-E2C4-11D7-A788-000A95A01192@optonline.net> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.552) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Tuesday, September 9, 2003, at 08:25 AM, Tim O'Brien wrote: > On Tue, 2003-09-09 at 06:58, Geir Magnusson Jr. wrote: >> I guess we were going to figure out if we want to add the artificial >> notion of the length field, or just ask people to use size(). >> 'length' >> is really weird, as it doesn't really exist as a field, and only >> applies to arrays. >> >> Why confuse the syntax with an additional way to get size? > > People may expect "length" to work, but as long as it is properly > documented for users I see no problem with asking people to use size() > instead of length. > > "length" is a public final field in all array types, It's not actually a field right? (in that it's artifically generated by the compiler, IIRC) [] aren't objects. > but from what I see > ASTIdentifier just delegates to ASTArrayAccess which then decides how > to > deal with an identifier (isMap -> isList -> isArray -> bean prop). > > We could just as easily add a step after accessing a bean property in > ASTArrayAccess which tried to access a public field. What do you > think? I think that just using size() is the right way to go. We want to avoid the situation where you have to know the exact type of the referent to use it. Conversely, you'd want the data model to be able to change (say substitute a j.u.List for an []) w/o the script using jexl having to change. If you believe that those two reasons are good, then either you have to make length behave exactly like size(), having two 'methods' that do the exact same thing, or ditch one for clarity and simplicity. I'm for the latter. geir -- Geir Magnusson Jr 203-956-2604(w) Adeptra, Inc. 203-434-2093(m) geirm@adeptra.com 203-247-1713(m)