From: Leopold Toetsch <[EMAIL PROTECTED]> Date: Wed, 12 Jul 2006 21:15:44 +0200
On Wed, Jul 12, 2006 at 01:27:24PM -0500, Patrick R. Michaud wrote: > The perl6 compiler has a custom string type, currently called > "Perl6Str". What's the canonically correct mechanism for creating > an object of that type? > > $P0 = new 'Perl6Str' > $P0 = new .Perl6Str > $P0 = new [ 'Perl6Str' ] > > At different stages of Parrot development I've seen different > answers to this question, so it'd be helpful to know what's "correct". Correct are all three, but . . . 2) only works, *if* the lib, which defines that type is already loaded (via :immediate/loadlib or .loadlib), because it's translated to new_p_ic, i.e. the type name is converted to a type number at compile time, which speeds up run time object creation. So the type is bound to a number in the .pbc? Isn't this dangerous for types that are not built in? Couldn't this number mean something different if libraries happen to get loaded in a different order? -- Bob Rogers http://rgrjr.dyndns.org/