Deprecation: foreach: loop index implicitly converted from size_t to int
user1234
user1234 at 12.de
Fri May 3 13:18:02 UTC 2024
On Friday, 3 May 2024 at 10:50:03 UTC, BoQsc wrote:
> Why am I forced to visit this D Lang thread, why this
> deprecation warning still appears in my console window in the
> latest version of DMD. Does not make any sense from the
> developer's perspective to show this warning and pollute the
> already polluted logging entries of the compiler. How am I
> suppose to program anything effectively if half of the screen
> are some nonsensical deprecation warnings without guidance or
> sane explanations.
>
> This is not better
> ```
> foreach (i, row; arr)
> ```
> than
> ```
> foreach (int i, row; arr)
> ```
> Hides the datatype and makes the D language appear in-explicit
> and annoying.
>
> What is this language becoming. A completely weak typed
> language or something?
>
> I would use JavaScript if I would want that. How are we suppose
> to make whole sane Operating Systems with such syntaxes. Do
> everyone just enjoy having bugs with some implicit size_t, or
> do everyone just enjoy deprecation warnings in their logging
> systems when there are way more important problems to solve,
> that are actually project related.
You can specify the index type, just choose the right one. For
now there's a deprecation message but after some while you'll get
a proper error message, e.g _"index type for arr must be of type
T because arr.length type is T"_.
What's is happening now is to help people updating their code and
prevent abrupt breakages.
More information about the Digitalmars-d-learn
mailing list