An example of typeclasses/traits/protocols/concepts in D with interfaces
sighoya
sighoya at gmail.com
Wed Dec 23 14:59:51 UTC 2020
On Wednesday, 23 December 2020 at 14:56:19 UTC, sighoya wrote:
> On Wednesday, 23 December 2020 at 14:23:34 UTC, Adam D. Ruppe
> wrote:
>> On Wednesday, 23 December 2020 at 14:20:39 UTC, sighoya wrote:
>>> 1.) Can't we import aliases from other modules or am I just
>>> too dumb to see how?
>>
>> plain import includes aliases....
>>
>
> Strange, because importing alias Instance(T:Number!double) =
> DoubleNumber; doesn't work it complains with errors.
>
>
>>> 2.) it would be nice to unscope the methods of a type
>>
>> that's what the `with` keyword does
>>
>> T square(T, alias Implementor...) {
>> with(Implementor) {
>> // here
>> }
>> }
>
> Nice, I wasn't aware of this, is akin to that possible for
> runtime objects?
Ah nice, I see it, theats great!
More information about the Digitalmars-d
mailing list