The "size" method comes from Enumerable#size. Array and Hash both have
it because they both mixin Enumerable, of course. It's a type-agnostic
way to get the number of items in a collection, since not all
collections have a "length" property.

This isn't the case for strings. Strings always have a "length"
property. So the argument for String#size, as Sylvain says, is
consistency. The argument against, as Jeff says, is bloat. I don't
care much either way, myself, but maybe someone else from Core has an

For now, Sylvain, just define String#size on your own. I doubt this'll
make it into core unless Sam thinks it's worth doing.


On Sep 30, 12:49 am, jdalton <[EMAIL PROTECTED]> wrote:
> I am a bit confused... what would "size" provide on other objects??
> Also what is to stop you from adding the "50 bytes" to your own code?

You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at

Reply via email to