RCR 326: Add Method 'length' to REXML::Elements
Submitted by zdennis (Wed Nov 16 13:01:41 UTC 2005)
Abstract
The
REXML::Elements class acts like an array, yet it only responds to the method 'size'. Being able to call 'length' seems like an intuitive metohd for the class to have.
Problem
The
REXML::Elements class acts like an array, yet it only responds to the method 'size'. Being able to call 'length' seems like an intuitive metohd for the class to have.
Proposal
Add the method 'length' as an alias to 'size' on the
REXML::Elements class.
Analysis
This proposal keeps consistency with arrays and other array-like objects found in ruby's core libraries and standard libraries, and it seems to follow principle of least surprise.
Implementation
In rexml/element.rb on line 929 add the following line of code:
alias :length :size
RCR does not cover the libraries I (matz) don't maintain. I like this proposal though. Ask for the maintainer (mneumann).
|
Strongly opposed |
0 |
Opposed |
0 |
Neutral |
0 |
In favor |
1 |
Strongly advocate |
0 |
|
RCRchive copyright © David Alan Black, 2003-2005.
Powered by .