develooper Front page | perl.perl6.language.subs | Postings from September 2000

Re: RFC 212 (v1) Make length(@array) work

From:
Dave Storrs
Date:
September 19, 2000 07:40
Subject:
Re: RFC 212 (v1) Make length(@array) work
Message ID:
Pine.BSF.4.10.10009190731430.52276-100000@megazone23.bigpanda.com


On Mon, 18 Sep 2000, Bart Lateur wrote:
> On 13 Sep 2000 07:07:42 -0000, Perl6 RFC Librarian wrote:
> 
> >Many newbies think of the number of
> >elements in an array as its "length"
> 
> Doesn't this reflect C's idea of "a string is an array of characters"?
> Which isn't the idea behind strings in Perl. The basic idea is wrong.
> Therefore, making length(@array) work, would be a wrong signal.

	I personally do not see the connection, but even if I did I would
still respectfully disagree.  This "wrong signal" would only be sent in
the case that someone (a) has some knowledge of C so that they know what a
string is "under the hood" and (b) is enough of a Perl newbie to not
understand that length is not used to get the number of elements in an
array.  That means that (1) anyone who does _not_ have C experience will
not have this problem, (2) anyone who is moderately experienced at Perl
will not have this problem.  As soon as someone discovers that
print("100"+2) is valid in Perl and prints 102, they should realize that
Perl is different from C.

					Dave




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About