Map Purity

2015-06-30 Thread jmh530 via Digitalmars-d-learn
My understanding of pure is that a function labeled pure can only include pure functions. I've been confused by the fact that a function calling map (like below) can be labeled pure without any problems. The only way I can rationalize it is that map really isn't a function, it's (if I'm underst

Re: Map Purity

2015-06-30 Thread jmh530 via Digitalmars-d-learn
On Sunday, 28 June 2015 at 16:15:31 UTC, Marc Schütz wrote: Secondly, `map` is indeed a template function, as you write. For templates functions, the compiler infers many properties, including purity. Thanks for the reply. Two follow ups: 1) Does labeling a template as pure matter if the co

Re: Map Purity

2015-06-30 Thread Xinok via Digitalmars-d-learn
On Sunday, 28 June 2015 at 15:55:51 UTC, jmh530 wrote: My understanding of pure is that a function labeled pure can only include pure functions. I've been confused by the fact that a function calling map (like below) can be labeled pure without any problems. The only way I can rationalize it is

Re: Map Purity

2015-06-30 Thread via Digitalmars-d-learn
On Sunday, 28 June 2015 at 15:55:51 UTC, jmh530 wrote: My understanding of pure is that a function labeled pure can only include pure functions. I've been confused by the fact that a function calling map (like below) can be labeled pure without any problems. The only way I can rationalize it is

Re: Map Purity

2015-06-30 Thread anonymous via Digitalmars-d-learn
On Sunday, 28 June 2015 at 16:28:20 UTC, jmh530 wrote: Thanks for the reply. Two follow ups: 1) Does labeling a template as pure matter if the compiler infers it anyway? 2) Does the compiler also infer anything for @safe/nothrow in templates? 1) It means you can't instantiate the template fun