D - 'in', 'out', returning references?
- skelly vatproducts.com (5/5) Apr 28 2004 I really like the use of "in" and "out" in argument lists, but
- J Anderson (7/13) Apr 28 2004 If your talking about a primitive type (int, float ect..) or a struct,
- Ivan Senji (3/8) Apr 28 2004 I also wish there was a way but there isn't :(
- Andy Friesen (4/7) Apr 28 2004 I'm not sure if this is what you're after, but it's perfectly legal to
- Andy Friesen (3/12) Apr 28 2004 .... whups. Need more coffee.
- Matthew (4/9) May 07 2004 Is it possible to return a struct which wraps a reference?
- Ivan Senji (15/26) May 08 2004 To do this i wrote a class that wraps a value returned, but the problem
I really like the use of "in" and "out" in argument lists, but because then the purpose is documented in the code, but is there a way to return a reference to an object besides using a pointer? (Note, sometimes it is a builtin type, sometimes not.) Sam
Apr 28 2004
skelly vatproducts.com wrote:I really like the use of "in" and "out" in argument lists, but because then the purpose is documented in the code, but is there a way to return a reference to an object besides using a pointer? (Note, sometimes it is a builtin type, sometimes not.) SamIf your talking about a primitive type (int, float ect..) or a struct, then without using out, and without using a pointer, no. If your talking about class objects, then these are already references (unlike C++ but like java). -- -Anderson: http://badmama.com.au/~anderson/
Apr 28 2004
<skelly vatproducts.com> wrote in message news:c6og8o$68h$1 digitaldaemon.com...I really like the use of "in" and "out" in argument lists, but because then the purpose is documented in the code, but is there a way to return a reference to an object besides using a pointer?I also wish there was a way but there isn't :((Note, sometimes it is a builtin type, sometimes not.) Sam
Apr 28 2004
skelly vatproducts.com wrote:I really like the use of "in" and "out" in argument lists, but because then the purpose is documented in the code, but is there a way to return a reference to an object besides using a pointer?I'm not sure if this is what you're after, but it's perfectly legal to say 'Object* o'. It behaves like a pointer-pointer would in C++. -- andy
Apr 28 2004
Andy Friesen wrote:skelly vatproducts.com wrote:.... whups. Need more coffee. -- andyI really like the use of "in" and "out" in argument lists, but because then the purpose is documented in the code, but is there a way to return a reference to an object *besides using a pointer?*I'm not sure if this is what you're after, but it's perfectly legal to say 'Object* o'. It behaves like a pointer-pointer would in C++.
Apr 28 2004
Is it possible to return a struct which wraps a reference? Doh! No. Structs do not have ctors/dtors. Maybe that's another argument for it? <skelly vatproducts.com> wrote in message news:c6og8o$68h$1 digitaldaemon.com...I really like the use of "in" and "out" in argument lists, but because then the purpose is documented in the code, but is there a way to return a reference to an object besides using a pointer? (Note, sometimes it is a builtin type, sometimes not.) Sam
May 07 2004
"Matthew" <matthew.hat stlsoft.dot.org> wrote in message news:c7hcc0$2878$1 digitaldaemon.com...Is it possible to return a struct which wraps a reference?To do this i wrote a class that wraps a value returned, but the problem is that the returned variable can only be accesed by property. I have something like ref!(int) func() { static int x; return new ref!(int)(x); } ... func().value=5;Doh! No. Structs do not have ctors/dtors.But constructor can be simulated with opCall. I don't undestand how you mean a struct wraping a reference?Maybe that's another argument for it? <skelly vatproducts.com> wrote in messagenews:c6og8o$68h$1 digitaldaemon.com...I really like the use of "in" and "out" in argument lists, but because then the purpose is documented in the code, but is there a way to return a reference to an object besides using a pointer? (Note, sometimes it is a builtin type, sometimes not.) Sam
May 08 2004