An (old/new?) pattern to utilize phobos better with @nogc

2018-06-16 Thread Dukc via Digitalmars-d
I think I have just found a pattern to ease the pain of @nogc programming somewhat. Consider this: import std.algorithm; import std.range; @nogc void main() { import core.stdc.stdio; int power = 2; foreach ( raised; iota(10) .dropOne .map!(num => num^^pow

Re: An (old/new?) pattern to utilize phobos better with @nogc

2018-06-17 Thread jmh530 via Digitalmars-d
On Saturday, 16 June 2018 at 11:58:47 UTC, Dukc wrote: snip] What are your thoughts? Do you agree with this coding pattern? I like it.

Re: An (old/new?) pattern to utilize phobos better with @nogc

2018-06-17 Thread Seb via Digitalmars-d
On Saturday, 16 June 2018 at 11:58:47 UTC, Dukc wrote: What are your thoughts? Do you agree with this coding pattern? It would even be better if map can recognize tuples and thus allows to simply use a lambda functions with two parameters, but in the past with a few exceptions there hasn't b

Re: An (old/new?) pattern to utilize phobos better with @nogc

2018-06-17 Thread Dukc via Digitalmars-d
On Sunday, 17 June 2018 at 13:50:31 UTC, Seb wrote: On Saturday, 16 June 2018 at 11:58:47 UTC, Dukc wrote: What are your thoughts? Do you agree with this coding pattern? It would even be better if map can recognize tuples and thus allows to simply use a lambda functions with two parameters,

Re: An (old/new?) pattern to utilize phobos better with @nogc

2018-06-17 Thread Dukc via Digitalmars-d
On Sunday, 17 June 2018 at 20:17:36 UTC, Dukc wrote: Yes, I agree. And each too, of course. Thought again and not so sure anymore: I just realized that if we are to do that, it should apply the same changes to tee, find, filter etc. Probably too complicated to be worth it. For @nogc, there

Re: An (old/new?) pattern to utilize phobos better with @nogc

2018-06-18 Thread Seb via Digitalmars-d
On Monday, 18 June 2018 at 06:54:46 UTC, Dukc wrote: On Sunday, 17 June 2018 at 20:17:36 UTC, Dukc wrote: Yes, I agree. And each too, of course. Thought again and not so sure anymore: I just realized that if we are to do that, it should apply the same changes to tee, find, filter etc. Proba