Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2024-05-11 Thread BoQsc via Digitalmars-d-learn
A horrible alternative would be to use `alias` on `size_t` to make up a new pseudo-type that is more aligned with the code logic. ``` alias integer = size_t; import std.stdio : writefln; void main() { auto arr = [ [5, 15], // 20 [2, 3, 2, 3], // 10 [3, 6, 2, 9]

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2024-05-03 Thread BoQsc via Digitalmars-d-learn
Well all these proposals to `int` index like `size_t` and `const typeof(arr.length)` are cryptic and less readable and less straightforward in comparison to how it used to be. Feels like horrible decision if the language is suppose to be somewhat futureproof. The `int` was simple, straighforwar

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2024-05-03 Thread user1234 via Digitalmars-d-learn
On Friday, 3 May 2024 at 15:19:13 UTC, user1234 wrote: On Friday, 3 May 2024 at 14:59:57 UTC, BoQsc wrote: On Friday, 3 May 2024 at 13:18:02 UTC, user1234 wrote: [...] So how would you update this example, what is the right index type here to choose? ``` import std.stdio : writefln; vo

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2024-05-03 Thread user1234 via Digitalmars-d-learn
On Friday, 3 May 2024 at 14:59:57 UTC, BoQsc wrote: On Friday, 3 May 2024 at 13:18:02 UTC, user1234 wrote: On Friday, 3 May 2024 at 10:50:03 UTC, BoQsc wrote: [...] **You can specify the index type, just choose the right one.** For now there's a deprecation message but after some while you'

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2024-05-03 Thread BoQsc via Digitalmars-d-learn
On Friday, 3 May 2024 at 13:18:02 UTC, user1234 wrote: 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 per

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2024-05-03 Thread user1234 via Digitalmars-d-learn
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 p

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2024-05-03 Thread BoQsc via Digitalmars-d-learn
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 sup

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2019-01-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, January 18, 2019 8:34:22 AM MST Michael via Digitalmars-d-learn wrote: > On Friday, 18 January 2019 at 13:29:29 UTC, Adam D. Ruppe wrote: > > On Friday, 18 January 2019 at 12:27:17 UTC, Michael wrote: > >> This, to be, looks like quite the explicit conversion, no? > > > > Yeah, I agree.

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2019-01-18 Thread Michael via Digitalmars-d-learn
On Friday, 18 January 2019 at 13:29:29 UTC, Adam D. Ruppe wrote: On Friday, 18 January 2019 at 12:27:17 UTC, Michael wrote: This, to be, looks like quite the explicit conversion, no? Yeah, I agree. But the language is silly. I just leave the type out of foreach and explicitly cast it inside t

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2019-01-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 18 January 2019 at 12:27:17 UTC, Michael wrote: This, to be, looks like quite the explicit conversion, no? Yeah, I agree. But the language is silly. I just leave the type out of foreach and explicitly cast it inside the body.

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2019-01-18 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 18 January 2019 at 12:27:17 UTC, Michael wrote: Hello all, I am getting this deprecation warning when compiling using DMD64 D Compiler v2.084.0 on Linux. I'm a little unsure what the problem is, however, because the code producing these warnings tends to be of the form: foreach

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2019-01-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/18/19 7:27 AM, Michael wrote: Hello all, I am getting this deprecation warning when compiling using DMD64 D Compiler v2.084.0 on Linux. I'm a little unsure what the problem is, however, because the code producing these warnings tends to be of the form: foreach (int i, ref prop; props)

Deprecation: foreach: loop index implicitly converted from size_t to int

2019-01-18 Thread Michael via Digitalmars-d-learn
Hello all, I am getting this deprecation warning when compiling using DMD64 D Compiler v2.084.0 on Linux. I'm a little unsure what the problem is, however, because the code producing these warnings tends to be of the form: foreach (int i, ref prop; props) This, to be, looks like quite the