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

Re: single element lists

Thread Previous | Thread Next
From:
Larry Wall
Date:
May 11, 2005 15:07
Subject:
Re: single element lists
Message ID:
20050511220741.GA6828@wall.org
On Thu, May 12, 2005 at 05:19:11AM +0800, Autrijus Tang wrote:
: Sure (and done).  Now that #1 is eliminated, the question is now
: whether a simple scalar can be treated as a small (one-element) array
: reference, much like a simple pair can be treated as a small
: (one-element) hash reference.
: 
:     1.[0];  # evaluates to 1?
: 
: If yes, then (1)[0] means the same as 1.[0] and 1.[0][0][0].  If no,
: (1)[0] is a runtime error just like 1.[0] -- i.e. unable to find the
: matching .[] multisub under Int or its superclasses.

Maybe we should just let someone poke a Subscriptable role into some
class or other to determine the behavior if they care.

Larry

Thread Previous | 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