auto arr = [1, 2, 3] should be a static array, not a GC allocated array
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Sun Jul 17 15:56:03 UTC 2022
On Sunday, 17 July 2022 at 14:43:01 UTC, ryuukk_ wrote:
> On Sunday, 17 July 2022 at 04:21:21 UTC, Ola Fosheim Grøstad
> wrote:
>> Yes, this could be done as an optimization, if people want to
>> enforce it then just let them add @nogc.
>
> This is why people think D is a Java++ and is a GC'd language
>
> Let's enforce this sentiment, and cement it so nothing can
> improve moving forward, never reflect, always double down
No, C and C++ are completely stuck in being overspecific, which
makes them time consuming languages to deal with, but a good
language will allow you to express intent and let the compiler
select the best performing implementation.
This makes much more sense for generic programming. You want to
write one implementation and let the compiler adapt the
implementation through optimization where it is trivial to do so.
What is concerning is that D has not improved on templates and
now C++ is becoming as convenient for library development if not
more so...
>> Nothing prevents you from creating your own
>> ‘mkarray!char(1,2,3,4)’?
>
> I'm not sure if you are being serious or not
The idiomatic C++20 way is similar `to_array<char>({1,2,3,4})`. I
don't see the big deal.
D needs to stop trying to drive in individual nails with special
casing and figure out the big picture.
More information about the Digitalmars-d
mailing list