C-like static array size inference - how?
Steven Schveighoffer
schveiguy at gmail.com
Wed Jun 8 01:32:42 UTC 2022
On 6/7/22 9:17 PM, forkit wrote:
> On Wednesday, 8 June 2022 at 01:11:45 UTC, Mike Parker wrote:
>>
>> ...The author withdrew the DIP ....
>> ..
>
> That's a shame.
>
> Seems like a useful language feature. I'd be using it already if it
> existed.
I agree, it's a pain to dig out an import and the verbose name, vs. just
putting in the `$`. Not to mention, I don't know if 2-dimensional or
n-dimensional static arrays are easy to capture with a library call +
literal.
These are the kinds of things that make D pleasant. Like `V[K2][K1]`
being more intuitive than `HashMap!(K1, HashMap!(K2, V))`.
>
> I'd have gone for:
>
> int[..] arr = [1,2,3];
I like `$`. It's got a well-defined meaning, and already is somewhat magic.
-Steve
More information about the Digitalmars-d-learn
mailing list