Re: RFC 212 (v1) Make length(@array) work
[email protected] (Dave Storrs) Wed, 20 Sep 2000 09:19:18 -0700 (PDT)
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Message-ID | <Pine.BSF.4.10.10009200908480.56880-100000@megazone23.bigpanda.com> |
On Wed, 20 Sep 2000, Bart Lateur wrote: > The argument against my reasoning would be if the bulk of people making > this mistake are *not* coming from C. I don't know. I have a feeling we're either arguing the same side without realizing it, or we're just having a straight-up conversational rift. Let me restate my opinion and see if that helps: @a = (1, 2, 3); print (length @a); The result should be that 3 is printed. The concept of "(# of elements in array) == (length of array)" is a common one in many languages. It is intuitive to many people...I know that I tried doing it when I first started using Perl. It does not seem to particularly interfere with existing semantics (although, I'm sure someone will point something out that I have not considered)...by which I mean that "length @foo" does not currently have any frequently-used meaning. I like Perl because it generally DWIMs. This seems like a good way to make it DWIM more. Dave