Re: Can't understand the application of delegates in toString() functions

2016-11-07 Thread Heisenberg via Digitalmars-d-learn
On Monday, 7 November 2016 at 16:54:06 UTC, Ali Çehreli wrote: On 11/07/2016 08:40 AM, Heisenberg wrote: [...] Exactly how it happens requires explaining a long chain of function calls. Probably that's why the author did not elaborate further. ;) I've probably omitted some steps here but I

Re: Can't understand the application of delegates in toString() functions

2016-11-07 Thread Ali Çehreli via Digitalmars-d-learn
On 11/07/2016 08:40 AM, Heisenberg wrote: On Monday, 7 November 2016 at 16:33:30 UTC, Adam D. Ruppe wrote: On Monday, 7 November 2016 at 16:22:17 UTC, Heisenberg wrote: Why? How can a delegate which returns nothing be used as an array which is going to be printed on the screen? You pass the s

Re: Can't understand the application of delegates in toString() functions

2016-11-07 Thread Heisenberg via Digitalmars-d-learn
On Monday, 7 November 2016 at 16:37:50 UTC, Mathias Lang wrote: On Monday, 7 November 2016 at 16:22:17 UTC, Heisenberg wrote: [...] When you ask for a string (or more generally, an array), you put a specific construct on the way the data should be. For starters, the items have to be contiguo

Re: Can't understand the application of delegates in toString() functions

2016-11-07 Thread Heisenberg via Digitalmars-d-learn
On Monday, 7 November 2016 at 16:33:30 UTC, Adam D. Ruppe wrote: On Monday, 7 November 2016 at 16:22:17 UTC, Heisenberg wrote: Why? How can a delegate which returns nothing be used as an array which is going to be printed on the screen? You pass the string to the delegate, which does whatever

Re: Can't understand the application of delegates in toString() functions

2016-11-07 Thread Mathias Lang via Digitalmars-d-learn
On Monday, 7 November 2016 at 16:22:17 UTC, Heisenberg wrote: Hi there. I'm currently following Ali Çehreli's "Programming in D" book and I can't seem to be able to wrap my head around the of delegates in the toString() functions.. http://ddili.org/ders/d.en/lambda.html (Bottom of the page)

Re: Can't understand the application of delegates in toString() functions

2016-11-07 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 7 November 2016 at 16:22:17 UTC, Heisenberg wrote: Why? How can a delegate which returns nothing be used as an array which is going to be printed on the screen? You pass the string to the delegate, which does whatever with it somewhere else. So you call: `passed_delegate("your str