A D vs. Rust example
jmh530
john.michael.hall at gmail.com
Thu Oct 27 20:43:02 UTC 2022
On Thursday, 27 October 2022 at 17:37:59 UTC, Quirin Schroll
wrote:
> On Friday, 21 October 2022 at 15:13:44 UTC, Ola Fosheim Grøstad
> wrote:
>> On Friday, 21 October 2022 at 13:53:28 UTC, Guillaume Piolat
>> wrote:
>>> But building and agreeing on abstractions is what define the
>>> ecosystem.
>>
>> One big weakness in C++ and D is that generic definitions
>> cannot be checked without instantiation.
>
> There aren’t many languages that have both, templates and
> generics; C++/CLI and C++/CX are the only ones I know and I
> happen to have some experience with them. (In this
> nomenclature: *template* = independent copy of the
> implementation for every distinct instantiation, cf. C++ or D
> templates, especially class templates with mutable static
> variables; *generic* = one implementation, cf. Java or C#, and
> static variables cannot depend on the argument types.)
>
> [snip]
Timon argued on the C++ pattern matching thread [1] that we need
"a way to parameterize functions and aggregates that is
completely erased at runtime (generally useful, not only for
lifetimes; e.g., this is how to fix `inout`.)". This bears some
similarity with generics.
[1] https://forum.dlang.org/post/tj633h$1g4e$1@digitalmars.com
More information about the Digitalmars-d
mailing list