Perl 6 Perl 6 Lists and Arrays vivified #62

Slices and autotrim

@words[3..7]            # always 5 elements
@words[3..*]            # autotrims to @words.elems

Why the inconsistency? Several reasons, but a big one is using a slice as a lvalue:

@words[3..7] = @more;   # should extend @words if needed
@words[3..*] = @more;   # only replace existing elements

There will also be syntactic constructs (likely a Parcel ending with Whatever) that allow the programmer to force a list to act infinite or finite:

@words[3..7,*]     # elements 3 through 7, autotrimmed
Copyright © 2012
http://www.pmichaud.com/2012/pres/