December 16, 2019 Re: Is there any chance to introduce concepts/traits/typeClasses in dlang? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rikki cattermole | I thought about your InputRange!T example and took a look at https://dlang.org/library/std/typecons/wrap.html I quite nice solves the problem with passing structures to interfaces, though it would still be nice if this is done automatically. |
December 16, 2019 Re: Is there any chance to introduce concepts/traits/typeClasses in dlang? | ||||
---|---|---|---|---|
| ||||
Posted in reply to sighoya | On Monday, 16 December 2019 at 16:45:12 UTC, sighoya wrote: > I thought about your InputRange!T example and took a look at https://dlang.org/library/std/typecons/wrap.html > > I quite nice solves the problem with passing structures to interfaces, though it would still be nice if this is done automatically. Damn, it only works for classes but it will probably introduced for structs, too: https://dlang.org/phobos/std_experimental_typecons.html |
December 16, 2019 Re: Is there any chance to introduce concepts/traits/typeClasses in dlang? | ||||
---|---|---|---|---|
| ||||
Posted in reply to sighoya | On Monday, 16 December 2019 at 16:45:12 UTC, sighoya wrote:
> I thought about your InputRange!T example and took a look at https://dlang.org/library/std/typecons/wrap.html
>
> I quite nice solves the problem with passing structures to interfaces, though it would still be nice if this is done automatically.
wrap only works for interfaces and classes, not structs.
|
December 16, 2019 Re: Is there any chance to introduce concepts/traits/typeClasses in dlang? | ||||
---|---|---|---|---|
| ||||
Posted in reply to jmh530 | On Monday, 16 December 2019 at 16:58:22 UTC, jmh530 wrote:
> On Monday, 16 December 2019 at 16:45:12 UTC, sighoya wrote:
>> I thought about your InputRange!T example and took a look at https://dlang.org/library/std/typecons/wrap.html
>>
>> I quite nice solves the problem with passing structures to interfaces, though it would still be nice if this is done automatically.
>
> wrap only works for interfaces and classes, not structs.
Oh we overlapped to the same time, but yes unfortunately it is true, only experimental d allows for it I think.
|
Copyright © 1999-2021 by the D Language Foundation