in reply to Re^6: I don't understand UNIVERSAL::DOES()
in thread I don't understand UNIVERSAL::DOES()
I really want to see a unification of all the various type-like detection code into one routine and it seems to me that DOES is the best candidate for the job.
Me too.
However, tying that to "What kind of SV is this?" is a mistake.
Yes, of course people can write bad DOES() methods. Yes, of course people can bless references into classes named after builtins and get the wrong answers. Yet people can also neglect to escape SQL from user input, build their own templating systems, build their own query parsers, forget to check the results of system commands, factor their code improperly, write ten-thousand line functions, use only global variables, and use symbolic references.
I don't really care if bad programmers can abuse a feature if that feature makes it easier for decent and good programmers to do their jobs well.
As I said, perhaps class names are the wrong role names for asking "does this entity support indexed access" or "does this entity support keyed access". That's fine.
But please give me a little credit as the Perl 6 designer who's thought about this for a few years now--unifying types and roles is a good thing. Querying objects and types about their capabilities instead of their peculiar and accidental structural lineage is a very good thing. Unifying that behind an interface that allows encapsulation of the how and merely asks the question "do you?" is the right thing.
I could never have convinced Larry and Damian, especially, if this were not so.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: I don't understand UNIVERSAL::DOES()
by demerphq (Chancellor) on Mar 11, 2007 at 09:14 UTC |