where to find Implements!

Steven Schveighoffer schveiguy at yahoo.com
Wed Sep 29 13:22:01 PDT 2010


On Wed, 29 Sep 2010 16:14:27 -0400, BLS <windevguy at hotmail.de> wrote:

> On 29/09/2010 21:19, Jonathan M Davis wrote:
>> On Wednesday, September 29, 2010 11:58:01 BLS wrote:
>>> Hope is was not a pipe dream...
>>> I've no idea who has published it and where to find this snippet but in
>>> case that I am not completely wrong there should exist something like
>>> Implements!() for structures..
>>> ???
>>> Bjoern
>>
>> And what would the implement? I thought that structs didn't work with
>> interfaces. And if they did, you'd use is() with : to test that. So,  
>> what are
>> you really looking for here? What would Implements!() do if it exists?
>>
>> - Jonathan M Davis
> Hi Jonathan,
> Just because structures don't work with interfaces I am still hoping for  
> Implements!().
>
> What do I expect from Implements!   A contract which ensures (at compile  
> time) that a structure implements f.i. all functions required by a  
> random access range.
>
> well, as said, I'm not even sure that Implements! exist at all.
> bjoern

Well, there are the isRandomAccessRange and friends, I think that's the  
standard mode of operation for testing if a struct implements a particular  
compile-time interface.

The thing is, there's no syntax to *define* a compile-time interface  
except this way :)

So Implements!(myStruct, ???)  Where ??? is the compile time interface,  
what do you pass in there?

-Steve


More information about the Digitalmars-d mailing list