where to find Implements!
BLS
windevguy at hotmail.de
Wed Sep 29 13:49:23 PDT 2010
On 29/09/2010 22:22, Steven Schveighoffer wrote:
> 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
Implements!(*I*MyInterface) // where IMyInterface is a plain vanilla
Interface
This was at least my hope 'cause IMHO this could make just f.i. the
range stuff more reliable.
Unfortunately we are not able to use classes to implement the basic
data-structures for collections/graphs. if we could use class Node,
class Tree : IxRange, class Map : Tree ...
Bjoern
ps have send you an email
More information about the Digitalmars-d
mailing list