Worst ideas/features in programming languages?
jmh530
john.michael.hall at gmail.com
Tue Oct 12 20:45:40 UTC 2021
On Tuesday, 12 October 2021 at 19:41:57 UTC, H. S. Teoh wrote:
> [snip]
>> * Features you'd like to see in D
> [...]
>
> - C++ concepts-like feature of specifying the expected
> interface of a
> template parameter.
> - Yes, sig constraints fit the bill, kinda-sorta. But it
> leads to
> poor, unhelpful error messages. Yes, this can be fixed by
> using
> static if, pragma(msg), etc., but this requires a lot of
> extra work
> on the part of the user which should have been handled by
> the
> language.
> - Yes, there's a dub package that kinda-sorta does this. But
> again,
> this is something that should have been done by the
> language.
>
>
I've become more sympathetic to this. The main argument against
DIP 1023 (resolution of template alias parameters in template
functions) boiled down to "why not use signature constraints."
Something like Concepts could be an alternative solution to the
problems addressed in that DIP (though that may not be the only
way to resolve them).
Runtime & static polymorphism comes in different types and
flavors. D has class, which is similar to how C++ and Java work
(ignoring some details). So we can group these together in a
run-time polymorphism. D's interface is similar to that, but
doesn't do exactly the same thing and is different from Go's
interface and Rust's traits system. Concepts as a form of static
polymorphism are in a different category as well. But how do we
group the categories in a way that makes sense?
More information about the Digitalmars-d
mailing list