Well I was validating data elements and I just had to do something
like :

if ((typeof data)=="string") size=data.length else size=data.size()

which seems quite counter-intuitive, maybe violating the
http://en.wikipedia.org/wiki/Principle_of_least_surprise

I don't take the prototypejs.org filesize as a valid argument for not
including String#size since it's less than 50bytes. Valid arguments
(to me) would include performance, API consistency, ... ?


On Sep 30, 2:20 am, Jeff Watkins <[EMAIL PROTECTED]> wrote:
> Er, sorry, the smart-ass in me got the best of me.
>
> I think Prototype is in danger of starting to bloat like other
> libraries and I think requests like this are exactly why.
>
> There's no possible reason to have a size method when there's a
> perfectly good length property.
>
> I'm certain someone will argue that Ruby strings have size methods.
> And of course, they might be right. But that's not a compelling
> reason to add a size method to JavaScript strings. Prototype is
> already a large enough download without adding unnecessary "features".
>
> On Sep 29, 2007, at 4:55 PM, Jeff Watkins wrote:
>
>
>
> > Maybe you've heard of the length property on String?
>
> > Why on earth would you need a size method?
>
> > On Sep 29, 2007, at 8:45 AM, Sylvain ZIMMER wrote:
>
> >> Hi all,
>
> >> I was a bit surprised not to find a size() method on String  (like
> >> Array, Enumerable, Hash, ...)
>
> >> So maybe there is a good reason not to (and I'd like to know it ;-),
> >> but wouldn't it be nice to have
>
> >> String.prototype.size = function() {
> >>        return this.length;
> >> }
>
> >> so that we can call size() whatever the object type is?
>
> >> thanks!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to