On Tue, Dec 07, 2004 at 12:32:50PM -0500, Abhijit Mahabal wrote: : According to S12, it is possible to supply the object layout to bless(), : like so: : : $object = $class.bless(:CREATE[:repr<P6opaque>] :k1($v1) :k2($v2)) : : But in the section "Introspection", "layout" is a class trait. Does this : mean that classes have a default layout that can be overriden for : individual objects?
Er, no. It's probably just a braino. If it works at all, I think it's probably for when the class doesn't specify a layout, or has a meta-layout that can handle multiple layouts. It might not even make sense for that. In general, a class should have a consistent layout. I think I was thinking about the fact that Perl 5's bless can just use whatever data structure you hand it. So maybe $object = $class.bless(:CREATE[:repr<P6Hash>] :k1($v1) :k2($v2)) is equivalent to $object = $class.bless({}, :k1($v1) :k2($v2)) But mostly I was just looking for an example option to pass to :CREATE. Perhaps :repr is a bit too violent for that. Larry