Hello again,

In Pugs, we are currently trying to figure out how classes are initialized with $repr types other than P6opaque. My interpretation of S12 is that P6opaque types are initialized as follows (by default):

&new is called with named arguments, it then calls &bless passing in 'P6opaque' as the $repr type, and the named arguments after it. &bless then calls &CREATE, which constructs the opaque type using all the attributes of the class (which are collected in 'descendent' (BUILD) order). At this point &BUILDALL is called, which itself calls all the &BUILD methods is can find (again in 'descendent' order).

S12 lists several other $repr types which &CREATE accepts such as P6hash, P5hash, P5array, PyDict & Cstruct. Some of these types are more conducive to construction in the manner in which &CREATE constructs P6opaques. These seem to be separate from the $canidate argument for &bless, which seems to work similar to how P5's &bless worked.

So my question is: What is the purpose of the different $repr types?

Should the other $repr types be used in the same manner as P6opaque? Just alternate types of internal storage. Or should using these other $repr types act more like blessing these same/similar types (blessing a hash, blessing an array, etc).

Thanks,

Stevan





Reply via email to