On Mon, Oct 12, 2015 at 09:51:13PM +0200, Mark Overmeer wrote: > > method new(MyClassHere:U: *@args) { ... } > > > > in the constructor, which would be quite hostile to newbies. It's still > > not clear to me how to avoid that. > > It is also unclear to me what this means. It is a method which requires > and undef parameter?
Because of the second colon, it's a method accepting an undef invocant. This is what would be needed in order for MyClassHere.new(...) to work the way you expect (since MyClassHere is undefined). > > Another concern is that if "everything" defaults to :D, then classes > > (and other type objects) aren't really first class objects anymore, > > which is a really neat thing to have. > > Can you give me an example? Many other languages are capable to live > without undef and have first class type objects. Keep in mind that what Perl 6 calls a "type object" isn't quite the same as class objects in other languages -- a Perl 6 typename is really an undefined instance of a class. In other words, the identifiers C<Int>, C<Rat>, C<Array> etc. refer to instances of those classes just like the literals C<3>, C<4/5>, and C<[1,2,3]> are instances of those classes. They share the same method spaces. Pm