On Saturday, February 15, 2003, at 08:47 AM, David Storrs wrote:
I can see five possible courses here:
1) We decide that my suggestion is a bad one and do nothing with it.
That's fine; I am not wedded to it, I just thought it was an
interesting idea that I wanted to raise.
2) (4, 1, 2)
Michael Lazzaro wrote:
So, IMO, the only reasonable answer is (3)... that a list in numeric
context returns the length. Thus we have consistency between lists
and arrays:
(1,2,3) + 4 # -- (1,2,3).length + 4 -- 7 (list)
[1,2,3] + 4 # -- [1,2,3].length + 4 -- 7 (array
2) (4, 1, 2) + 7 returns (9). This is C comma behavior, and I always
found it incredibly non-intuitive. I'd really like to get away
from this, even if it means that this expression is a fatal error
Can't add scalar to list.
[...]
Agreed, however, that (2) is icky. My worry has
On Tue, Feb 18, 2003 at 10:06:29PM -, Smylers wrote:
More practically, the length of a list is never interesting: a list by
definition must be hardcoded into the program so its length is known at
compile time. Indeed it should be known by whoever typed it in!
Err, no. Eg in perl 5: