Re: 'const' and 'in' parameter storage classes

2015-05-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/15/15 2:19 PM, ref2401 wrote: On Friday, 15 May 2015 at 16:30:29 UTC, Steven Schveighoffer wrote: On 5/15/15 12:04 PM, ref2401 wrote: What is the difference between 'const' and 'in' parameter storage classes? When should I use 'const' or 'in'? The documentation says 'in' is the same

Re: 'const' and 'in' parameter storage classes

2015-05-18 Thread Marco Leise via Digitalmars-d-learn
Am Mon, 18 May 2015 09:05:51 -0400 schrieb Steven Schveighoffer schvei...@yahoo.com: On 5/15/15 2:19 PM, ref2401 wrote: On Friday, 15 May 2015 at 16:30:29 UTC, Steven Schveighoffer wrote: On 5/15/15 12:04 PM, ref2401 wrote: What is the difference between 'const' and 'in' parameter storage

'const' and 'in' parameter storage classes

2015-05-15 Thread ref2401 via Digitalmars-d-learn
What is the difference between 'const' and 'in' parameter storage classes? When should I use 'const' or 'in'? The documentation says 'in' is the same as 'const scope' but I can't write 'const scope ref' though it's legal to write 'in ref'. Thank you

Re: 'const' and 'in' parameter storage classes

2015-05-15 Thread Adam D. Ruppe via Digitalmars-d-learn
The scope storage class means you promise not to escape any reference to the data. This isn't enforced but it is similar in concept to Rust's borrowed pointers - it may someday be implemented to be an error to store them in an outside variable. Only use 'in' if you are looking at the data,

Re: 'const' and 'in' parameter storage classes

2015-05-15 Thread ref2401 via Digitalmars-d-learn
On Friday, 15 May 2015 at 16:30:29 UTC, Steven Schveighoffer wrote: On 5/15/15 12:04 PM, ref2401 wrote: What is the difference between 'const' and 'in' parameter storage classes? When should I use 'const' or 'in'? The documentation says 'in' is the same as 'const scope' but I can't write

Re: 'const' and 'in' parameter storage classes

2015-05-15 Thread ref2401 via Digitalmars-d-learn
On Friday, 15 May 2015 at 16:08:31 UTC, Adam D. Ruppe wrote: The scope storage class means you promise not to escape any reference to the data. This isn't enforced but it is similar in concept to Rust's borrowed pointers - it may someday be implemented to be an error to store them in an

Re: 'const' and 'in' parameter storage classes

2015-05-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 15 May 2015 at 18:18:13 UTC, ref2401 wrote: globalPtr = ms; // is it legal? No, but the compiler check isn't implemented.

Re: 'const' and 'in' parameter storage classes

2015-05-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/15/15 12:04 PM, ref2401 wrote: What is the difference between 'const' and 'in' parameter storage classes? When should I use 'const' or 'in'? The documentation says 'in' is the same as 'const scope' but I can't write 'const scope ref' though it's legal to write 'in ref'. scope ref const