develooper Front page | perl.perl6.language | Postings from September 2005

.chars, .bytes, etc.

Thread Next
From:
wolverian
Date:
September 24, 2005 03:45
Subject:
.chars, .bytes, etc.
Message ID:
20050924104500.GA7880@sci.fi
Hi all,

After some thinking it occured to me that the current way of defining
.chars, .bytes and .elems (and whatever else there are) doesn't make any
sense to me. In pugs at least they currently return the amount of units
in question - in any context! Why not define .chars like this:

    Context     Return value
    item        amount of units
    list        units themselves

Juerd proposed this list originally, which matches my thinking.

Originally I thought that .elems and .chars were symmetric and both
should behave the same semantically, but now I think that's false - if
there should be an .elems method, leave it at returning an Int at all
times. @foo.elems returning the elements in @foo makes no sense.

-- 
wolverian

Thread Next


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