|
Problem: You want to create one or more initializers for your class: methods that, when called on a newly created object, initialize that object. Solution: Use the
Discussion: Initializers in Perl6 are defined using Initializers may be multimethods: there may be any number of initializers, each accepting different arguments and initializing the object in different ways. (This recipe is a placeholder, until it is determined whether 'init' is different from 'new' in Perl6 classes.) Issue: It is actually fairly dubious that initializers could be effectively autochained, if they are allowed to have arguments (since the arguments for parent classes and subclasses wouldn't necessarily match.)
|