Little demo of allowing basic types to implement interfaces.
Rory McGuire
rjmcguire at gmail.com
Tue Sep 3 23:39:04 PDT 2013
On Wednesday, 4 September 2013 at 06:27:54 UTC, Rory McGuire
wrote:
> On Wednesday, 4 September 2013 at 06:26:08 UTC, Rory McGuire
> wrote:
>> On Wednesday, 4 September 2013 at 00:56:55 UTC, Rory McGuire
>> wrote:
>>> I was wondering if its possible to do interfaces the way
>>> #golang does it
>>> but in #dlang.
>>>
>>> Here is my first try:
>>> https://gist.github.com/rjmcguire/6431542.
>>> Any help on making this smaller would be awesome.
>>>
>>> Cheers,
>>> R
>>
>> Here is another example use, checking if a type can convert
>> itself to ubyte[]:
>
> You can play with it here: http://dpaste.dzfl.pl/d7a727fd
>
> I still need to implement the part that checks aggregates.
hmmm, turns out it works on aggregates too.
works for structs, classes and basic types such as int and long.
Makes me wonder; is this in the standard library.
More information about the Digitalmars-d-announce
mailing list