Protocols vs Concepts?

Shammah Chancellor anonymous at coward.com
Thu Nov 21 16:11:29 PST 2013


On 2013-11-21 19:30:00 +0000, Andrei Alexandrescu said:

> On 11/21/13 10:45 AM, Jacob Carlborg wrote:
>> On 2013-11-21 17:02, Andrei Alexandrescu wrote:
>> 
>>> Interfaces can't check for a variety of things that Boolean conditions
>>> can (isInfinite comes to mind).
>> 
>> Why wouldn't you be able to put the implementation of isInfinite in an
>> interface?
> 
> It's a value, not a type.
> 
> Walter and I went a couple of times over the idea of using interfaces 
> for concept conformance during the early days, and figured general 
> Boolean logic is more powerful for expressing constraints.
> 
> 
> Andrei

I am not suggesting using polymorphism for this.  That would to the 
same diamond problems when things support multiple concepts.  All I am 
suggesting is that Phobos should have a a generalized checker for 
concepts rather than a bunch of specific templates.  And I am 
suggesting that templated interfaces could be the thing this checks 
against (or other concrete types as needed)

-Shammah



More information about the Digitalmars-d mailing list