Perl 6 More laziness and lists #30

Range is interesting

Early implementations had a separate RangeIter class

✗ Lots of attribute coupling between Range and RangeIter

But Range objects are immutable

Will always return the same sequence of values

Thus Range.reify($n) can easily compute and return values and the Range needed to continue the sequence

> (0..10).reify(5).perl
(0, 1, 2, 3, 4, 5..10)
> (5..10).reify(5).perl
(5, 6, 7, 8, 9, 10)

✓ Having Range handle its own reification is much cleaner ☺

Copyright © 2012
http://www.pmichaud.com/2012/pres/