Miroslav Silovic wrote:
Uhm, but C++ templates are subject to (compile-time) MMD, once you specialise them. In other words,

role Something[Int $num] {...}
role Something[String $num] {...}

Hmm, C++ has no free floating templates. They always template a class/struct or a function. The Perl6 equivalent is to have e.g.

role Template[ ::Type ] {...}

multi sub foo( Template[Int] $x ) {...}
multi sub foo( Template[Str] $x ) {...}

And since roles are not instanciable the above actually
needs a class that does Template.

Questions for @Larry:

would making ::Type optional look as follows:

role Template[ ?::Type = Str ] {...}

or refering to the class that Template is composed into:

role Template[ ?::Type = $?CLASS ] {...}


I think having the full flexibility of required, optional and named parameters plus their slurpy versions, etc. is enough. What does a long/short name distinction add in expressiveness? -- TSa (Thomas SandlaÃ)



Reply via email to