D - The Hokey Cokey :)
- chris jones (15/15) Sep 07 2002 Whats the diferance between out and inout? In Delphi there is the var
- chris jones (6/13) Sep 07 2002 referance',
- Walter (5/6) Sep 07 2002 An inout passes a reference to a value in, which can be modified. An out
- chris jones (4/10) Sep 09 2002 It makes sense now.
- Sean L. Palmer (16/31) Sep 08 2002 I really like the idea of tuples, which are inherently just anonymous
Whats the diferance between out and inout? In Delphi there is the var keyword which i guese is the same as out as is basicly 'pass by referance', although it does have one ambiguity where if you need to pass an object by referance does the callee or called function create and clean up the object. I geuse this isnt a problem with a GC. So anyway i have an idea... if you have a function void foo(int x, int y, out a, out h); how about allowing the syntax to call the function... (p, q) = foo(x,y); which would be treated as identical to foo(x,y, out p, out q) so it would be purely cosmetic, much nicer to look at ihmo. Mabey there would need to be the limitation that it can only be used with functions with no return type? chris
Sep 07 2002
"chris jones" <flak clara.co.uk> wrote in message news:ale82d$v0o$1 digitaldaemon.com...Whats the diferance between out and inout? In Delphi there is the var keyword which i guese is the same as out as is basicly 'pass byreferance',although it does have one ambiguity where if you need to pass an object by referance does the callee or called function create and clean up theobject.I geuse this isnt a problem with a GC. So anyway i have an idea... if you have a function void foo(int x, int y, out a, out h);should be void foo(int x, int y, out float a, out float h);
Sep 07 2002
"chris jones" <flak clara.co.uk> wrote in message news:ale82d$v0o$1 digitaldaemon.com...Whats the diferance between out and inout?An inout passes a reference to a value in, which can be modified. An out passes a reference to an uninitialized value; the function is expected to initialize it.
Sep 07 2002
"Walter" <walter digitalmars.com> wrote in message news:aleesk$1dfd$1 digitaldaemon.com..."chris jones" <flak clara.co.uk> wrote in message news:ale82d$v0o$1 digitaldaemon.com...It makes sense now. chrisWhats the diferance between out and inout?An inout passes a reference to a value in, which can be modified. An out passes a reference to an uninitialized value; the function is expected to initialize it.
Sep 09 2002
I really like the idea of tuples, which are inherently just anonymous structs. Tuples can be used as parameter lists or multiple return values or anywhere you'd use a regular struct. They replace the std::pair template in C++ among other things. Then treat the return values and parameter lists of functions in the language as just being tuples, and you're set. You construct a tuple with (a,b,c) syntax and if the types match or are convertible, it can be assigned to a compatible tuple or struct. I'd support naming tuple members (such as parameter list identifiers) (int a, int b, char[] c) and initialization by named fields. (a:1,b:2,c:"foo") Sean "chris jones" <flak clara.co.uk> wrote in message news:ale82d$v0o$1 digitaldaemon.com...Whats the diferance between out and inout? In Delphi there is the var keyword which i guese is the same as out as is basicly 'pass byreferance',although it does have one ambiguity where if you need to pass an object by referance does the callee or called function create and clean up theobject.I geuse this isnt a problem with a GC. So anyway i have an idea... if you have a function void foo(int x, int y, out a, out h); how about allowing the syntax to call the function... (p, q) = foo(x,y); which would be treated as identical to foo(x,y, out p, out q) so it would be purely cosmetic, much nicer to look at ihmo. Mabey there would need to be the limitation that it can only be used with functionswithno return type? chris
Sep 08 2002