anon

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

http://en.wikisource.org/wiki/Tao_Te_Ching_(James_Legge) - helper, an (observer), though intelligent, might greatly err about them. This is called 'The utmost degree of mystery.' 28 Who knows his manhood's strength, Yet still his female feebleness maintains; As to one channel flow the many drains, All come to him, yea, all beneath the sky. Thus he the constant excellence retains; The simple child again, free from all stains. Who knows how white attracts, Yet always keeps himself within black's shade, The pattern of humility displayed, Displayed in view of all beneath the sky; He in the unchanging excellence arrayed, Endless return to man's first state has made. Who knows how glory shines, Yet loves disgrace, nor e'er for it is pale; Behold his presence in a spacious vale, To which men come from all beneath the sky. The unchanging excellence completes its tale; The simple infant man in him we hail. The unwrought material, when divided and distributed, forms vessels. The sage, when employed, becomes the Head of all the Officers (of government); and in his greatest regulations he employs no violent measures. 29 If any one should wish to get the kingdom for himself, and to effect this by what he does, I see that he will not succeed. The kingdom is a spirit-like thing, and cannot be got by active doing. He who would so win it destroys it; he who would hold it in his grasp loses it. The course and nature of things is such that What was in front is now behind; What warmed anon we...
Tags:
Ching
HISTORY
Tao
Taoism
Te

http://www.perlfoundation.org/perl6 - - square brackets, and we now distinguish the "of" property from the "returns" property.] I suppose you could also write that as: my Array of Array of Hash of Array of Cat %pet; but for linguistic reasons it's probably better to keep the variable name near the left and put the long, heavy phrases to the right. (People tend to prefer to say the short parts of their sentences before the long parts--linguists call this the "end-weight" problem.) The "Hash" is implied by the %pet, so you could leave out the ""is"" part and just say: my %pet of Array of Array of Hash of Array of Cat; Another possibility is: my Cat %pet is Hash of Array of Array of Hash of Array; That one reads kinda funny if you leave out the ""is Hash"", though. Nevertheless, it says that we have this funny data structure that has multiple parameters that you can view as a funny function returning "Cat". In fact, ""returns"" is a synonym for ""of"". This is also legal: my @litter returns Cat; [Update: Not any more.] But the ""returns"" keyword is mostly for use by functions: my Cat sub find_cat($name) {...} is the same as: my sub find_cat($name) returns Cat {...} This is more important for things like closures that have no ""my"" on the front: $closure = sub ($name) returns Cat { ...} Though for the closure case, it's possible we could define some kind of non-"my" article to introduce a type unambiguously: $closure = a Camel sub ($name) {...}...
Tags:
Apocalypse
larry
perl
perl6
wall
Next Page »