in reply to [Perl 6] Method call versus function call on a data set
When you use grep on something similar to an array, it will just automagically work.
And it works because everything that is similar to an array does (implements) the Sequence Role (in Perl 6 that is), but from the user's point of view you don't need to know that.
So if your libraries are designed carefully, you don't need to think very much at all - if the methods you try to use make sense in that context, they are most probably implemented. And if not, the compiler/interpreter will complain - not nice, but it doesn't really happen very often.
|
|---|