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

.chars, .bytes, etc.

Thread Next
September 24, 2005 03:45
.chars, .bytes, etc.
Message ID:
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.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About