Re: Explicitly saying ref or out when invoking a function

2009-08-13 Thread Lionello Lunesu
"Andrei Alexandrescu" wrote in message news:h5vtj8$1l7...@digitalmars.com... Lionello Lunesu wrote: "Andrei Alexandrescu" wrote in message news:h5ttfi$cf...@digitalmars.com... Lionello Lunesu wrote: "Jeremie Pelletier" wrote in message news:h5sl4c$173...@digitalmars.com... It's especi

Re: Explicitly saying ref or out when invoking a function

2009-08-12 Thread Andrei Alexandrescu
Lionello Lunesu wrote: "Andrei Alexandrescu" wrote in message news:h5ttfi$cf...@digitalmars.com... Lionello Lunesu wrote: "Jeremie Pelletier" wrote in message news:h5sl4c$173...@digitalmars.com... It's especially bad since if you modify the function prototype and change ref, you have all

Re: Explicitly saying ref or out when invoking a function

2009-08-12 Thread Lionello Lunesu
"Andrei Alexandrescu" wrote in message news:h5ttfi$cf...@digitalmars.com... Lionello Lunesu wrote: "Jeremie Pelletier" wrote in message news:h5sl4c$173...@digitalmars.com... It's especially bad since if you modify the function prototype and change ref, you have all your calls to update to

Re: Explicitly saying ref or out when invoking a function

2009-08-12 Thread Ary Borenszweig
Andrei Alexandrescu escribió: Lionello Lunesu wrote: "Jeremie Pelletier" wrote in message news:h5sl4c$173...@digitalmars.com... It's especially bad since if you modify the function prototype and change ref, you have all your calls to update too. That must be the best argument to introduce

Re: Explicitly saying ref or out when invoking a function

2009-08-12 Thread Ary Borenszweig
Lionello Lunesu escribió: "Jeremie Pelletier" wrote in message news:h5sl4c$173...@digitalmars.com... It's especially bad since if you modify the function prototype and change ref, you have all your calls to update too. That must be the best argument to introduce repeating ref and out! No,

Re: Explicitly saying ref or out when invoking a function

2009-08-12 Thread Andrei Alexandrescu
Lionello Lunesu wrote: "Jeremie Pelletier" wrote in message news:h5sl4c$173...@digitalmars.com... It's especially bad since if you modify the function prototype and change ref, you have all your calls to update too. That must be the best argument to introduce repeating ref and out! L. //

Re: Explicitly saying ref or out when invoking a function

2009-08-12 Thread Lionello Lunesu
"Jeremie Pelletier" wrote in message news:h5sl4c$173...@digitalmars.com... It's especially bad since if you modify the function prototype and change ref, you have all your calls to update too. That must be the best argument to introduce repeating ref and out! L.

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Nick Sabalausky
"Jeremie Pelletier" wrote in message news:h5sl4c$173...@digitalmars.com... > Ary Borenszweig Wrote: > > It's especially bad since if you modify the function prototype and change > ref, you have all your calls to update too. I'd consider that a benefit. If I have a function: void foo(int x) {

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Nick Sabalausky
"Jarrett Billingsley" wrote in message news:mailman.329.1250026310.14071.digitalmar...@puremagic.com... > On Tue, Aug 11, 2009 at 4:05 PM, Nick Sabalausky wrote: >> Although, what some people have said about just coloring it in an editor >> is >> not a bad point (althogh it seems like we may be

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread soso
Ary Borenszweig Wrote: > In C# when you define a function that takes an out or ref parameter, > when invoking that function you must also specify ref or out. For example: > > void fun(ref uint x, double y); > > uint a = 1; > double b = 2; > fun(ref a, b); > > What do you think? I agree

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Jarrett Billingsley
On Tue, Aug 11, 2009 at 4:05 PM, Nick Sabalausky wrote: > Although, what some people have said about just coloring it in an editor is > not a bad point (althogh it seems like we may be starting to run out of > colors...). If your syntax highlighting is using so many colors that you're worried abou

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Jeremie Pelletier
Ary Borenszweig Wrote: > In C# when you define a function that takes an out or ref parameter, > when invoking that function you must also specify ref or out. For example: > > void fun(ref uint x, double y); > > uint a = 1; > double b = 2; > fun(ref a, b); > > When I first started using C# it r

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Adam D. Ruppe
On Tue, Aug 11, 2009 at 04:28:06PM -0400, bearophile wrote: > There's an intermediate solution, to make "ref" optional at the calling site > (as in the "override" case). I don't know how much this can improve the > situation. That seems to me to defeat the point, since you can't rely on it anymo

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread bearophile
BCS Wrote: > It would make template programming harder. > > template TplFn(alias fn) > { > void TplFn(T...)(T t) > { > fn(t); // what if fn has normal, ref and out args? > } > } There's an intermediate solution, to make "ref" optional at the calling site (as in the "override"

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Steven Schveighoffer
On Tue, 11 Aug 2009 15:47:15 -0400, Michiel Helvensteijn wrote: Ary Borenszweig wrote: In C# when you define a function that takes an out or ref parameter, when invoking that function you must also specify ref or out. For example: void fun(ref uint x, double y); uint a = 1; double b =

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Bill Baxter
On Tue, Aug 11, 2009 at 12:47 PM, Michiel Helvensteijn wrote: > Ary Borenszweig wrote: > >> In C# when you define a function that takes an out or ref parameter, >> when invoking that function you must also specify ref or out. For example: >> >> void fun(ref uint x, double y); >> >> uint a = 1; >> d

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Bill Baxter
On Tue, Aug 11, 2009 at 1:05 PM, Nick Sabalausky wrote: > "Ary Borenszweig" wrote in message > news:h5s3e9$2km...@digitalmars.com... >> In C# when you define a function that takes an out or ref parameter, when >> invoking that function you must also specify ref or out. For example: >> >> void fun(

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Nick Sabalausky
"Ary Borenszweig" wrote in message news:h5s3e9$2km...@digitalmars.com... > In C# when you define a function that takes an out or ref parameter, when > invoking that function you must also specify ref or out. For example: > > void fun(ref uint x, double y); > > uint a = 1; > double b = 2; > fun(r

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Michiel Helvensteijn
Ary Borenszweig wrote: > In C# when you define a function that takes an out or ref parameter, > when invoking that function you must also specify ref or out. For example: > > void fun(ref uint x, double y); > > uint a = 1; > double b = 2; > fun(ref a, b); > > What do you think? I see what you

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Jarrett Billingsley
On Tue, Aug 11, 2009 at 11:40 AM, Ary Borenszweig wrote: > In C# when you define a function that takes an out or ref parameter, when > invoking that function you must also specify ref or out. For example: > > void fun(ref uint x, double y); > > uint a = 1; > double b = 2; > fun(ref a, b); > > When

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Denis Koroskin
Ary Borenszweig Wrote: > In C# when you define a function that takes an out or ref parameter, > when invoking that function you must also specify ref or out. For example: > > void fun(ref uint x, double y); > > uint a = 1; > double b = 2; > fun(ref a, b); > > When I first started using C# it r

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Edward Diener
Ary Borenszweig wrote: In C# when you define a function that takes an out or ref parameter, when invoking that function you must also specify ref or out. For example: void fun(ref uint x, double y); uint a = 1; double b = 2; fun(ref a, b); When I first started using C# it really annoyed me th

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread BCS
Reply to Ary, In C# when you define a function that takes an out or ref parameter, when invoking that function you must also specify ref or out. For example: void fun(ref uint x, double y); uint a = 1; double b = 2; fun(ref a, b); When I first started using C# it really annoyed me that I had t

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread bearophile
Ary Borenszweig: > What do you think? I don't know. It's a different design choice. Generally explicit is better and safer, but I don't know much safer this is. Overall I think the C# choice here is a bit better, but you have to write lot of code before being able to tell C# has chosen for the

Re: Explicitly saying ref or out when invoking a function

2009-08-11 Thread Lutger
Ary Borenszweig wrote: > In C# when you define a function that takes an out or ref parameter, > when invoking that function you must also specify ref or out. For example: > > void fun(ref uint x, double y); > > uint a = 1; > double b = 2; > fun(ref a, b); > > When I first started using C# it re

Explicitly saying ref or out when invoking a function

2009-08-11 Thread Ary Borenszweig
In C# when you define a function that takes an out or ref parameter, when invoking that function you must also specify ref or out. For example: void fun(ref uint x, double y); uint a = 1; double b = 2; fun(ref a, b); When I first started using C# it really annoyed me that I had to put that ke