Sex, 2008-05-02 às 15:32 +0200, TSa escreveu: > Daniel Ruoso wrote: > > I don't really see what this "is :strict" means in the runtime > > environment. Perl 6 takes OO so deeply that even the type checking is > > implemented as a cal to the object. There isn't really a way of asking > > "are you trully really a Dog?", there's only "do you 'Dog'?". > Sorry, where is this specced?
It's an implicit consequence of supporting different metamodels and representations. The operator cannot assume to know how the object is laid out, it must ask the object about it. Again, of course optimizations can simplify that if everybody knows each other, but it still should be able to take a Glib object as if it was an Array. The only types the operators can assume to know are the native types. >From S12: All public method calls are "virtual" in the C++ sense. More surprisingly, any class name mentioned in a method is also considered virtual, that is, polymorphic on the actual type of the object. You may derive from any built-in type, but the derivation of a low-level type like int may only add behaviors, not change the representation. Use composition and/or delegation to change the representation. Specially the "polymorphic on the actual type of the object". There's no direct relation between the class "Dog" and the "actual type" of some Dog object, which may imply on how this object is laid out, so the operators can't really do anything except asking the object "do you 'Dog'"? daniel