C++ or D?
sighoya
sighoya at gmail.com
Wed Dec 30 19:24:19 UTC 2020
On Wednesday, 30 December 2020 at 18:45:03 UTC, Ola Fosheim
Grøstad wrote:
> Some people in the D community has for a long time wanted
> stack-less coroutines. This is now available in C++20, and
> maybe D can borrow the C++ implementation for LDC? That is an
> interesting possibility for sure.
>
Hmm, I don't know much about them, but it seems they are a
restriction to stackful coroutines, maybe a keyword addition like
@stackless to prohibit nested suspension does the trick?
> The main addition for C++20 is concepts. Basically wrapping up
> ugly tests in a simple template parameter type specifier so
> that you can specify that a template parameter MUST support
> Addition or be a Stack or whatever you want to require with
> very simple syntax. (It also makes it easier to specify tests.)
In my eyes, adding proper support for opImplicitCoercion enables
the reuse of interfaces as typeclasses, yielding more potential
for idiomatic development than utilizing C++ concepts alone.
> Btw, did D ever get to add nested template parameters? I know
> people asked for it a long time ago, but cannot remember if
> that was resolved somehow?
Oh, what's this? Did you mean true Higher Kinded Types (HKT)
```
fun(R,S,T:R=>S)
```
That would be great, but they're simply arguing to use alias
symbols instead. The downside with aliases is however a more
restricted type inference:
https://github.com/dlang/DIPs/blob/bf5157d3dc29a591826e22d188448fbc04ca81b2/DIPs/DIP1023.md
https://forum.dlang.org/thread/dnyqxmgdazczwmmvayjx@forum.dlang.org?page=4
> I almost never use multiple inheritance myself, but if you
> don't use it, it does not affect you at all? So how could it be
> a problem to have the option? *shrugs*
It's right, at least theoretically, practically you are often
forced to use the feature in order to utilize the functionality
you need.
But the more general point against this was the clash of fields
and methods. However, this is akin to the problem with generic
specialization, and likewise it can be solved by simply defining
a new default instance, that's it.
More information about the Digitalmars-d-learn
mailing list