But a real routine invoking the new routine could achieve the same result.
Of course. Currying is just a shortcut.
On the other hand, putting my in the main script will not have any effect in the package, will it?
I think that's the point :-)
In Damian's example the List::Part::part() function is non-upwardly compatable with earlier versions because of the addition of the parameter.
The problem is - how do we make legacy code that calls the old-style part() use the new-style part()?
One option would be to go through them by hand and alter the calls to part() appropriately.
Instead, we can add a single line that creates a lexically scoped subroutine that curries in the old default label arguments - so the calls to the old-style part() will continue to work.
Make sense?
In reply to Re: Perl 6 Exegesis 6 pg 7
by adrianh
in thread Perl 6 Exegesis 6 pg 7
by TomDLux
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |