On Sunday, 16 August 2015 at 23:40:41 UTC, Brandon Ragland wrote:
On Sunday, 16 August 2015 at 23:31:46 UTC, Ali Çehreli wrote:
On 08/16/2015 04:13 PM, Brandon Ragland wrote:
> That makes more sense. Though it does make the ref method
> signature unclear, as it only applies to literals at this
On Sunday, 16 August 2015 at 23:31:46 UTC, Ali Çehreli wrote:
On 08/16/2015 04:13 PM, Brandon Ragland wrote:
> That makes more sense. Though it does make the ref method
> signature unclear, as it only applies to literals at this
> point?
As long as the returned object will be valid after the fu
On 08/16/2015 04:13 PM, Brandon Ragland wrote:
> That makes more sense. Though it does make the ref method
> signature unclear, as it only applies to literals at this
> point?
As long as the returned object will be valid after the function leaves,
it can be anything: one of the ref parameters,
On Sunday, 16 August 2015 at 22:35:15 UTC, Alex Parrill wrote:
On Sunday, 16 August 2015 at 22:31:02 UTC, Brandon Ragland
wrote:
Hi All, I'm a bit confused as to how Classes in D are passed
in arguments and returns.
Take this for example:
class MyClass{
int x = 2;
}
And then in app.d
ref My
On Sunday, 16 August 2015 at 22:31:02 UTC, Brandon Ragland wrote:
Hi All, I'm a bit confused as to how Classes in D are passed in
arguments and returns.
Take this for example:
class MyClass{
int x = 2;
}
And then in app.d
ref MyClass doStuff(){
MyClass mc = new MyClass() // Heap allocation,
On Sunday, 16 August 2015 at 22:31:02 UTC, Brandon Ragland wrote:
ref MyClass doStuff(){
MyClass mc = new MyClass() // Heap allocation, using new
return mc;
}
This attempts to return a reference to the _variable_ `mc`, not a
reference to the class. Just remove `ref` from the function
sig
Hi All, I'm a bit confused as to how Classes in D are passed in
arguments and returns.
Take this for example:
class MyClass{
int x = 2;
}
And then in app.d
ref MyClass doStuff(){
MyClass mc = new MyClass() // Heap allocation, using new
return mc;
}
The above fails, as "escaping reference