On Saturday, 25 July 2015 at 20:35:08 UTC, Walter Bright wrote:
On 7/25/2015 3:29 AM, Jonathan M Davis wrote:
We're essentially using it with ranges already when we're
implementing
algorithms differently based on what type of range we're given
or what extra
capabilities the range has, so it obviously is showing its
usefulness there,
That's right. We've already been doing it in a haphazard
manner, what Andrei is doing is recognizing the technique,
naming it, and thinking about how to formalize it, organize it,
and determine best practices.
It's like going from an ad-hoc table of function pointers to
recognizing that one is doing OOP.
Well, it'll be interesting to see what he comes up with.
but the allocators is the only other case that I can think of
at the moment where it
would make sense to use it heavily.
Containers are another fairly obvious use case.
Yes. There are definitely places that DbI is going to be huge. I
just have a hard time coming up with them. So, while I agree that
it's a fantastic tool, I'm just not convinced yet that it's going
to be one that's widely applicable. I guess that we'll just have
to wait and see what Andrei comes up with and where others take
it from there. But it's definitely something that D can do rather
easily and most other languages can't do at all, so it's a big
win for us in that regard, especially if it does turn out to be
widely applicable.
On a related note, while I'd noticed it on some level, I don't
think that it had ever clicked for me how restrictive interfaces
are before this discussion. The simple fact that you can't ask
for two of them at once really reduces how reusable your code can
be. So, templatizing those checks rather than using interfaces is
huge. And DbI is an extension of that. There's likely a lot of
unplumbed depth there.
- Jonathan M Davis