Quoting A12...
> Note that an attribute declaration of the form
> 
>     has Tail $wagger .= new(...)
> 
> might not do what you want done when you want it done, if what you
> want done is to create a new Dog object each time an object is built.
> For that you'd have to say:
> 
>     has Tail $wagger = { .new(...) }
> 
> or equivalently,
> 
>     has Tail $wagger will build { .new(...) }

Since $wagger is meant to be an object attribute, shouldn't it have a
dot?  And is omitting the dot an error?

        has Tail $.wagger = { .new(...) }       # right?

Also, based on the earlier assertion that closure valued attributes
get the attribute as the topic, shouldn't the text say "to create a
new Tail object" rather than "Dog"?  i.e.,

        has Tail $.wagger = { .new(...) }               # is the same as
        has Tail $.wagger = { $.wagger.new(...) }

which does some appropriate magic to call Tail.new because $.wagger
hasn't been initialized yet. Or is Tail also a Dog somehow? What happens
if the attribute is untyped? Presumably that's an error.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to