www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - in, out, and inout parameters

reply Matthew Gordon <Matthew_member pathlink.com> writes:
Have you considered the following perl-inspired syntax for function calls:

( d, e ) = foo( a, b, c );

Where a,b,c are in parameters and d, e are out parameters? Inout parameters
would not be needed 
because you could just write:

( b, c ) = foo( a, b );

This effectively makes b inout. 

This is effectively returning a struct from the function, but saves needing a
separate declaration. This 
style of syntax makes it clear which functions are in and out but putting the
out parameters on the 
other side of the assignment opperator. 
Mar 02 2005
parent reply "Walter" <newshound digitalmars.com> writes:
It's been suggested. Many like it.
Mar 02 2005
parent reply "Nick Sabalausky" <z a.a> writes:
"Walter" <newshound digitalmars.com> wrote in message 
news:d05nki$1ads$2 digitaldaemon.com...
 It's been suggested. Many like it.

Heheh, I take it that means you don't?
Mar 02 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Nick Sabalausky" <z a.a> wrote in message
news:d05um4$1gcn$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> wrote in message
 news:d05nki$1ads$2 digitaldaemon.com...
 It's been suggested. Many like it.

Heheh, I take it that means you don't?

I'm not too comfortable with it <g>.
Mar 02 2005
parent reply "Lionello Lunesu" <lio lunesu.removethis.com> writes:
Hi..

 Heheh, I take it that means you don't?


From a compiler programmer point-of-view? (I mean, would it parse terribly?) L.
Mar 03 2005
parent "Walter" <newshound digitalmars.com> writes:
"Lionello Lunesu" <lio lunesu.removethis.com> wrote in message
news:d06ho5$255n$1 digitaldaemon.com...
 Hi..

 Heheh, I take it that means you don't?


From a compiler programmer point-of-view? (I mean, would it parse

(exp, exp) already has a meaning in D, and this would change that in a context, dependent way. Not impossible, but kinda kludgy. I also just can't escape a wince looking at it. It just doesn't look right.
Mar 09 2005