anonymous
A story of my life... As someone completely anonymous.
Tags:
tamponmovie

http://www.perlfoundation.org/perl6 - - attribute, and no lexical parameter is generated. You can mix these with ordinary parameters--the general rule of thumb for an initializer is that you should see each dotted attribute at least once: submethod BUILD ($.a, $.b, $c) { $.c = mung($c); } This feature is primarily intended for use in constructors and initializers, but Perl does not try to guess which subroutines fall into that category (other than the fact that Perl 6 will implicitly call certain conventional names like CREATE and BUILD.) However, submethods such as BUILD are assumed to have an extra *%_ parameter to soak up any extra unrecognized named arguments. Ordinarily you must declare a slurp-hash explicitly to get that behavior. But BUILD submethods are always called with named arguments (except for the invocant), and often have to ignore arguments intended for other classes participating in the current construction. It's likely that this implicit *%_ feature extends to other routines declared in all-caps as well, and perhaps all submethods. [Update: Turns out that all methods and submethods work this way.] As in Perl 5, subroutines declared in all-caps are expected to be called automatically most of the time--but not necessarily all the time. The BUILD routine is a good example, because it's only called automatically when you rely on the default class initialization rules. But you can override those rules, in which case you may have to call...
Tags:
Apocalypse
larry
perl
perl6
wall

http://www.perlfoundation.org/perl6 - - want to fill out all the optional parameters, and you aren't planning to use named notation to skip the rest of them? How can you make both transitions simultaneously? There are two workarounds. First, suppose we have a "push"-like signature such as this: sub stuff (@array, ?$how, *@list) {...} The declarative workaround is to move the optional parameters after the slurp array, so that they are required to be specified as named parameters: sub stuff (@array, *@list, +$how) {...} Then you can treat the slurp array as a positional parameter. That's the solution we used to add an extra argument to "push" earlier, where the list always starts at the second argument. [Update: The slurpy array is now always treated as a positional parameter even if there are named parameters intervening.] On the calling end, you don't have any control of the declaration, but you can always specify one of the arguments as named, either the final positional one, or the list itself: stuff(@foo, how =] undef, 1,2,3) stuff(@foo, list =] (1,2,3)) The latter is clearer and arguably more correct, but it has a couple of minor problems. For one thing, you have to know what the parameter name is. It's all very well if you have to know the names of optional parameters, but *every* list operator has a list that you really ought to be able to feed without knowing its name. So we'll just say that the actual name of the slurpy list parameter is...
Tags:
Apocalypse
larry
perl
perl6
wall
Next Page »