Rob Kinyon wrote: > "Any practical programming language with structural subtyping will > probably let you create and use aliases for type names (so you don't > have to write the full form everywhere). However, the underlying type > system will only consider the structure of the type when doing its > job." > > What's wrong with Perl doing things that way? duck-typing with names > ... sounds like a plan to me ...
The thing is that people using .does(Name) and .isa(Name) is probably expecting a nominal answer, not a structural one. Although I do think Visual Basic's explicit duck-subtypes makes a lot of sense: my subset Duck where { has $.half_life; can doom:(); can quake:(--> Wolfenstein); }; then you can apply it as a ducktype with names: my Duck $donald = some_function(); $donald.quake; # assured to return a Wolfenstein object It's already part of S12, by the way. Audrey
signature.asc
Description: OpenPGP digital signature