Re: writeln wipes contents of variables ?

2016-01-22 Thread W.J. via Digitalmars-d-learn
On Friday, 22 January 2016 at 01:47:19 UTC, Rikki Cattermole wrote: Contrary to what it is called in the links, this is a NewsGroup/Mailing list and not a forum. So no editing ability :) I'll keep that in mind. Thanks :)

Re: writeln wipes contents of variables ?

2016-01-22 Thread W.J. via Digitalmars-d-learn
On Friday, 22 January 2016 at 01:49:58 UTC, anonymous wrote: On 22.01.2016 01:49, W.J. wrote: How can I identify those ranges, or, how can I tell if any particular range has value semantics ? I didn't read any of this in the manual - not that I could remember anyways. Generally you

Re: writeln wipes contents of variables ?

2016-01-21 Thread Rikki Cattermole via Digitalmars-d-learn
On 22/01/16 2:11 AM, W.J. wrote: Hi everybody! I'm new to D and trying to wrap my head around ranges. For a start I'm trying to take a input string and transform it, group it, etc. After each step I inspect the result. It works fine until step 3 where all of a sudden, after write(ln)ing the

Re: writeln wipes contents of variables ?

2016-01-21 Thread W.J. via Digitalmars-d-learn
On Thursday, 21 January 2016 at 13:15:46 UTC, Rikki Cattermole wrote: Ok so input ranges. An input range is a little bit like an iterator (if you know what that is). When an input range has been read fully, it is empty aka no longer has any values associated with it. writeln, reads an

writeln wipes contents of variables ?

2016-01-21 Thread W.J. via Digitalmars-d-learn
Hi everybody! I'm new to D and trying to wrap my head around ranges. For a start I'm trying to take a input string and transform it, group it, etc. After each step I inspect the result. It works fine until step 3 where all of a sudden, after write(ln)ing the result, "step3" holds an array of

Re: writeln wipes contents of variables ?

2016-01-21 Thread Rikki Cattermole via Digitalmars-d-learn
On 22/01/16 3:07 AM, W.J. wrote: On Thursday, 21 January 2016 at 13:15:46 UTC, Rikki Cattermole wrote: Ok so input ranges. An input range is a little bit like an iterator (if you know what that is). When an input range has been read fully, it is empty aka no longer has any values associated

Re: writeln wipes contents of variables ?

2016-01-21 Thread W.J. via Digitalmars-d-learn
On Thursday, 21 January 2016 at 14:36:36 UTC, Rikki Cattermole wrote: On 22/01/16 3:07 AM, W.J. wrote: On Thursday, 21 January 2016 at 13:15:46 UTC, Rikki Cattermole wrote: [...] Thanks for your reply. So writeln consumes the values in an InputRange. That leads me to believe that if I

Re: writeln wipes contents of variables ?

2016-01-21 Thread Chris Wright via Digitalmars-d-learn
On Thu, 21 Jan 2016 14:07:16 +, W.J. wrote: > So writeln consumes the values in an InputRange. That leads me to > believe that if I feed an InputRange to foreach, it will consume the > values, too. > Did I get that right ? In general, yes. Some ranges have value semantics and can be saved

Re: writeln wipes contents of variables ?

2016-01-21 Thread W.J. via Digitalmars-d-learn
On Thursday, 21 January 2016 at 21:59:10 UTC, Chris Wright wrote: On Thu, 21 Jan 2016 14:07:16 +, W.J. wrote: So writeln consumes the values in an InputRange. That leads me to believe that if I feed an InputRange to foreach, it will consume the values, too. Did I get that right ? In

Re: writeln wipes contents of variables ?

2016-01-21 Thread anonymous via Digitalmars-d-learn
On 22.01.2016 01:49, W.J. wrote: How can I identify those ranges, or, how can I tell if any particular range has value semantics ? I didn't read any of this in the manual - not that I could remember anyways. Generally you shouldn't. If you care about it either way, use .save or

Re: writeln wipes contents of variables ?

2016-01-21 Thread Rikki Cattermole via Digitalmars-d-learn
On 22/01/16 5:45 AM, W.J. wrote: On Thursday, 21 January 2016 at 14:36:36 UTC, Rikki Cattermole wrote: On 22/01/16 3:07 AM, W.J. wrote: On Thursday, 21 January 2016 at 13:15:46 UTC, Rikki Cattermole wrote: [...] Thanks for your reply. So writeln consumes the values in an InputRange. That