++Phobos

rikki cattermole rikki at cattermole.co.nz
Fri Oct 18 00:19:08 UTC 2019


On 18/10/2019 8:37 AM, Meta wrote:
> On Thursday, 17 October 2019 at 16:21:18 UTC, Atila Neves wrote:
>> On Wednesday, 16 October 2019 at 22:34:00 UTC, rikki cattermole wrote:
>>> On 17/10/2019 11:16 AM, H. S. Teoh wrote:
>>>> [...]
>>>
>>> So these sorts of "functions" are aggregates of behavior and 
>>> properties that require reading the source code to know fully what it 
>>> entails.
>>>
>>> [...]
>>
>> https://github.com/atilaneves/concepts/blob/master/source/concepts/implements.d 
>>
> 
> Correct me if I'm wrong, but would using this with std.range be as 
> simple as:
> 
> import std.range;
> 
> @implements!(MyCoolRange, InputRange)
> struct MyCoolRange(T)
> {
>      ....
> }
> 
> long sum(R)(R range)
> if (implements!(R, InputRange))
> {
>      ....
> }

This unfortunately still ties the implementation itself to the 
interface. Which goes against DbI.


More information about the Digitalmars-d mailing list