Why is there no range iteration with index by the language?

2020-06-09 Thread Q. Schroll via Digitalmars-d-learn
Is there any particular reason why std.range : enumerate is a thing and foreach (i, e; range) { ... } doesn't work from the get-go? I wouldn't have such an issue with it if static foreach would work with enumerate just fine. As far as I can tell, foreach (e; range) { ... } is

Re: Why is there no range iteration with index by the language?

2020-06-09 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jun 09, 2020 at 11:53:16PM +, Q. Schroll via Digitalmars-d-learn wrote: > Is there any particular reason why std.range : enumerate is a thing > and > > foreach (i, e; range) { ... } > > doesn't work from the get-go? [...] std.range.indexed is your friend. ;-) T -- Let's eat

Re: Why is there no range iteration with index by the language?

2020-06-09 Thread Seb via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 23:53:16 UTC, Q. Schroll wrote: Is there any particular reason why std.range : enumerate is a thing and foreach (i, e; range) { ... } doesn't work from the get-go? I wouldn't have such an issue with it if static foreach would work with enumerate just fine. As

Re: Metaprogramming with D

2020-06-09 Thread tastyminerals via Digitalmars-d-learn
On Monday, 8 June 2020 at 14:41:55 UTC, Jan Hönig wrote: On Sunday, 7 June 2020 at 00:45:37 UTC, Ali Çehreli wrote: dmd -mixin= ... thanks for the tip! writeln(q{ void foo() { } }); What is the name of this `q` thing? How do i find it? Are there any recent tutorials

Re: Why is there no range iteration with index by the language?

2020-06-09 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 23:53:16 UTC, Q. Schroll wrote: Is there any particular reason why std.range : enumerate is a thing and [...] I don't think there is any particular reason. Other than that might shadow an opApply. And C++ iterators didn't have it.

Re: 32 bit phobos

2020-06-09 Thread Seb via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 17:58:56 UTC, welkam wrote: I tried to compile a 32 bit executable but my system does not have 32 bit phobos. How do I get 32 bit phobos? I am using Manjaro. dmd -m32 source/test2.d /usr/bin/ld: skipping incompatible

Re: Why is there no range iteration with index by the language?

2020-06-09 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jun 09, 2020 at 05:03:55PM -0700, H. S. Teoh via Digitalmars-d-learn wrote: > On Tue, Jun 09, 2020 at 11:53:16PM +, Q. Schroll via Digitalmars-d-learn > wrote: > > Is there any particular reason why std.range : enumerate is a thing > > and > > > > foreach (i, e; range) { ... } >

Re: Alpine support for D

2020-06-09 Thread aberba via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 01:06:30 UTC, aberba wrote: On Tuesday, 9 June 2020 at 14:23:34 UTC, Jesse Phillips wrote: I notice that in the new release for Alpine Linux it mentions support for D. I was curious what was meant by this and thought someone here would know. Just high level,

Re: Alpine support for D

2020-06-09 Thread aberba via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 14:23:34 UTC, Jesse Phillips wrote: I notice that in the new release for Alpine Linux it mentions support for D. I was curious what was meant by this and thought someone here would know. Just high level, like druntime was ported or packages added to the repo?

Re: Why is there no range iteration with index by the language?

2020-06-09 Thread Q. Schroll via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 00:53:30 UTC, Seb wrote: It's a bit more complicated though as you need to avoid subtle breakage with ranges that return tuples that are auto-expanded like e.g. `foreach (k,v; myDict)`. Okay, I can accept that. It's a poor decision, but well, it is what it is.

Re: Why is there no range iteration with index by the language?

2020-06-09 Thread Seb via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 01:35:32 UTC, Q. Schroll wrote: On Wednesday, 10 June 2020 at 00:53:30 UTC, Seb wrote: It's a bit more complicated though as you need to avoid subtle breakage with ranges that return tuples that are auto-expanded like e.g. `foreach (k,v; myDict)`. Okay, I can

Re: Alpine support for D

2020-06-09 Thread MoonlightSentinel via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 14:23:34 UTC, Jesse Phillips wrote: I notice that in the new release for Alpine Linux it mentions support for D. Announcement: https://forum.dlang.org/thread/raue6j$1vp4$2...@digitalmars.com

Alpine support for D

2020-06-09 Thread Jesse Phillips via Digitalmars-d-learn
I notice that in the new release for Alpine Linux it mentions support for D. I was curious what was meant by this and thought someone here would know. Just high level, like druntime was ported or packages added to the repo?

filter custom version id from __traits code

2020-06-09 Thread Basile B. via Digitalmars-d-learn
I don't see how to filter a custom version identifier from this traits code: --- module test; import std.traits : isCallable; version(all) version = my_version; private bool onlyFuncs() { bool result = true; foreach (member; __traits(allMembers, mixin(__MODULE__))) {

32 bit phobos

2020-06-09 Thread welkam via Digitalmars-d-learn
I tried to compile a 32 bit executable but my system does not have 32 bit phobos. How do I get 32 bit phobos? I am using Manjaro. dmd -m32 source/test2.d /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../libphobos2.a when searching for -lphobos2 /usr/bin/ld:

Re: filter custom version id from __traits code

2020-06-09 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 17:40:10 UTC, Basile B. wrote: Any idea ? As I replied in the issue report: Instead of static if (!is(mixin(member) == module) && !(is(mixin(member use static if (is(typeof(mixin(member

Re: filter custom version id from __traits code

2020-06-09 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 18:08:01 UTC, Stanislav Blinov wrote: On Tuesday, 9 June 2020 at 17:40:10 UTC, Basile B. wrote: Any idea ? As I replied in the issue report: Instead of static if (!is(mixin(member) == module) && !(is(mixin(member use static if (is(typeof(mixin(member

Re: Metaprogramming with D

2020-06-09 Thread Ali Çehreli via Digitalmars-d-learn
On 6/8/20 7:50 AM, ag0aep6g wrote: https://ddili.org/ders/d.en/literals.html#ix_literals.q%7B%7D Thank you. I am biased but I like my :) index of the book, where all such syntax items appear: https://ddili.org/ders/d.en/ix.html Ali

Re: Metaprogramming with D

2020-06-09 Thread ag0aep6g via Digitalmars-d-learn
On 09.06.20 20:16, Ali Çehreli wrote: I am biased but I like my :) index of the book, where all such syntax items appear:   https://ddili.org/ders/d.en/ix.html Oh yeah. It's how I got the link. You might want to fix some of the URLs, though. Characters like '{' or '[' need to be