Virtual extension methods -- a strawman design
Kieron.Wilkinson at paretopartners.com
Kieron.Wilkinson at paretopartners.com
Tue May 18 00:36:26 PDT 2010
On 17 May 2010, Pavel Minaev <int19h at gmail.com> wrote:
> I'd expect so. Why do you fear it? It means that many algorithms could
> be written in a more generic way than they are today. Where today you
> have to accept Collection, solely because you need size() on it, you'd
> be able to accept an Iterable instead, and be just as efficient as
> before when someone passes you a Collection. More genericity is good;
> why fear it?
>From my perspective, it rather depends on whether the type indicates a
contract. Collection implies a finite number of items, but Iterable does
not. For many purposes, calling something like size() on an Iterable
object will never return. If the method is not there, you can't call it.
For example, you might have a Iterable implementation that provides an
infinite set of calculated items, like the Fibonacci sequence. This sort
of thing can be quite common (and very useful) when programming in a more
functional style.
Kieron
This message may contain confidential and privileged information and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorised. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator and then immediately delete this message. Although we attempt to sweep e-mail and attachments for viruses, we do not guarantee that either are virus-free and accept no liability for any damage sustained as a result of viruses.
Please refer to http://www.bnymellon.com/disclaimer/piml.html for certain disclosures.
More information about the lambda-dev
mailing list