Because that would be less powerful and slower. Each call to can() would have to create a closure but, in 90% of the cases, it would be almost immediately destroyed.
With the current implementation you can get what you want rather easily. [ This is shown elsewhere in this thead, but please don't override UNIVERSAL::can() as you'll just break other code in some module that is used by some module... that you used. Instead, provide that functionality via a different method name. ] But if your implementation were the default then there would be no easy way to get the current information.
It would no longer work to say $o1->can($m) == $o2->can($m) to see if two objects are using the same implementation of a method, for example.
- tyeIn reply to Re: Why isn't ->can() curried? (power)
by tye
in thread Why isn't ->can() curried?
by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |