auto arr = [1, 2, 3] should be a static array, not a GC allocated array

ryuukk_ ryuukk.dev at gmail.com
Sun Jul 17 14:43:01 UTC 2022


On Sunday, 17 July 2022 at 04:21:21 UTC, Ola Fosheim Grøstad 
wrote:
> On Saturday, 16 July 2022 at 22:44:07 UTC, welkam wrote:
>> On Thursday, 14 July 2022 at 13:14:59 UTC, ryuukk_ wrote:
>>> Also why it is GC allocated without requiring ``new``?
>>
>> Its easier to write average code without always thinking about 
>> allocations. Its optimized for average coder.
>
> 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

That's concerning

> The focus should be on things that matters, more special syntax 
> is not a net positive.
> New features ought to be more generic, like deduction guides in 
> C++.

I agree with that, some other features are more important, it is 
not urgent, but still is something that should be handled without 
suggesting importing modules and without writing template soup

> Nothing prevents you from creating your own 
> ‘mkarray!char(1,2,3,4)’?

I'm not sure if you are being serious or not

Why `1+1`? why not

```D
import std.math;
add(1, 1):
```

Why `do_something(1)`? why not

```D
import std.function;
call_function( do_something ).with_arg(1);
```

why `array[1] == 'c'`? why not

```D
import std.array;
contains(array, 1, 'c');
```

User should be suggested to write code to solve the problem he is 
trying to solve in his program

Not suggesting to write code to fix the deficiencies of the 
language

That is why people come up with new languages; and that messages 
is what's pushing people to choose alternatives



More information about the Digitalmars-d mailing list