Re: Setting a list of values

2016-05-07 Thread Brian Schott via Digitalmars-d-learn
On Monday, 2 May 2016 at 10:15:04 UTC, Marc Schütz wrote: This check can be done purely by looking at the tokens. In other words it's trivial for D-Scanner to warn about this. https://github.com/Hackerpilot/Dscanner/issues/341

Re: Setting a list of values

2016-05-07 Thread sigod via Digitalmars-d-learn
On Monday, 2 May 2016 at 23:41:39 UTC, Steven Schveighoffer wrote: On 5/2/16 6:00 PM, sigod wrote: On Monday, 2 May 2016 at 10:15:04 UTC, Marc Schütz wrote: On Monday, 2 May 2016 at 08:46:31 UTC, Ali Çehreli wrote: [...] Warning (better: disallowing altogether) about `=>` directly followed

Re: Setting a list of values

2016-05-07 Thread sigod via Digitalmars-d-learn
On Wednesday, 4 May 2016 at 04:56:54 UTC, Joel wrote: On Sunday, 1 May 2016 at 05:42:00 UTC, Ali Çehreli wrote: [...] This seems to work the best: arr.each!(a => { writeln(a); }()); And the ugliest. And probably slowest.

Re: Setting a list of values

2016-05-03 Thread Joel via Digitalmars-d-learn
On Sunday, 1 May 2016 at 05:42:00 UTC, Ali Çehreli wrote: On 04/30/2016 10:05 PM, Joel wrote: > This has no effect: > _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0); }); This is a common issue especially for people who know lambdas from other languages. :) Your lambda does not do

Re: Setting a list of values

2016-05-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/2/16 6:00 PM, sigod wrote: On Monday, 2 May 2016 at 10:15:04 UTC, Marc Schütz wrote: On Monday, 2 May 2016 at 08:46:31 UTC, Ali Çehreli wrote: [...] Warning (better: disallowing altogether) about `=>` directly followed by `{` should be enough to cover all cases. To express that you

Re: Setting a list of values

2016-05-02 Thread sigod via Digitalmars-d-learn
On Monday, 2 May 2016 at 10:15:04 UTC, Marc Schütz wrote: On Monday, 2 May 2016 at 08:46:31 UTC, Ali Çehreli wrote: [...] Warning (better: disallowing altogether) about `=>` directly followed by `{` should be enough to cover all cases. To express that you really want a lambda returning a

Re: Setting a list of values

2016-05-02 Thread Marc Schütz via Digitalmars-d-learn
On Monday, 2 May 2016 at 08:46:31 UTC, Ali Çehreli wrote: On 05/01/2016 12:54 PM, Xinok wrote: > On Sunday, 1 May 2016 at 05:42:00 UTC, Ali Çehreli wrote: >> On 04/30/2016 10:05 PM, Joel wrote: >> > This has no effect: >> > _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0); >> }); >> >>

Re: Setting a list of values

2016-05-02 Thread Ali Çehreli via Digitalmars-d-learn
On 05/01/2016 12:54 PM, Xinok wrote: > On Sunday, 1 May 2016 at 05:42:00 UTC, Ali Çehreli wrote: >> On 04/30/2016 10:05 PM, Joel wrote: >> > This has no effect: >> > _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0); >> }); >> >> This is a common issue especially for people who know

Re: Setting a list of values

2016-05-01 Thread Marc Schütz via Digitalmars-d-learn
On Sunday, 1 May 2016 at 05:42:00 UTC, Ali Çehreli wrote: On 04/30/2016 10:05 PM, Joel wrote: > This has no effect: > _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0); }); This is a common issue especially for people who know lambdas from other languages. :) Your lambda does not do

Re: Setting a list of values

2016-04-30 Thread Ali Çehreli via Digitalmars-d-learn
On 04/30/2016 10:05 PM, Joel wrote: > This has no effect: > _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0); }); This is a common issue especially for people who know lambdas from other languages. :) Your lambda does not do any work. Rather, your lambda returns another lambda,

Setting a list of values

2016-04-30 Thread Joel via Digitalmars-d-learn
This has no effect: _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0); }); I tried putting ..each!((ref a) =>.. with no difference This works: foreach(b; _bars) { b._plots.fillColor = Color(255, 180, 0); }