Re: which language allows you to change an argument's value?

2007-10-06 Thread John W. Kennedy
Roedy Green wrote: > On Sun, 30 Sep 2007 10:47:13 -, Summercool > <[EMAIL PROTECTED]> wrote, quoted or indirectly quoted someone > who said : >> and now n will be 3. I think C++ and PHP can let you do that, using >> their reference (alias) mechanism. And C, Python, and Ruby probably >> won't

Re: which language allows you to change an argument's value?

2007-10-01 Thread Scott Gifford
Summercool <[EMAIL PROTECTED]> writes: > I wonder which language allows you to change an argument's value? [...] > What about Java and Perl? Perl will let you change the value of a passed-in object directly. Others have already answered about Java. > is there any way t

Re: which language allows you to change an argument's value?

2007-10-01 Thread James Kanze
On Sep 30, 6:49 pm, Summercool <[EMAIL PROTECTED]> wrote: > On Sep 30, 4:18 am, 7stud -- <[EMAIL PROTECTED]> wrote: > > SpringFlowers AutumnMoon wrote: > > > we have no way > > > of knowing what we pass in could get changed. > > Sure you do. You look at the function's signature. In order to use

Re: which language allows you to change an argument's value?

2007-10-01 Thread Erik Wikström
On 2007-09-30 23:03, Arne Vajhøj wrote: > Erik Wikström wrote: >>> their reference (alias) mechanism. And C, Python, and Ruby probably >>> won't let you do that. What about Java and Perl? >> >> C will let you do it with pointers (it is just a syntactical difference >> from references in this cas

Re: which language allows you to change an argument's value?

2007-10-01 Thread Sascha Bohnenkamp
> Neither C or Java has call by reference. > C pointers and Java references may work similarly in most cases > but it is still call by value. so what? the references in c++ are passed by value too, its just a nice interface to pointers. At the end those parameters are pushed on the stack .. thats i

Re: which language allows you to change an argument's value?

2007-09-30 Thread Roedy Green
On Sun, 30 Sep 2007 10:47:13 -, Summercool <[EMAIL PROTECTED]> wrote, quoted or indirectly quoted someone who said : >and now n will be 3. I think C++ and PHP can let you do that, using >their reference (alias) mechanism. And C, Python, and Ruby probably >won't let you do that. What about J

Re: which language allows you to change an argument's value?

2007-09-30 Thread Arne Vajhøj
Erik Wikström wrote: >> their reference (alias) mechanism. And C, Python, and Ruby probably >> won't let you do that. What about Java and Perl? > > C will let you do it with pointers (it is just a syntactical difference > from references in this case) and Java's references allows it. Neither C

Re: which language allows you to change an argument's value?

2007-09-30 Thread Jerry Stuckle
Erik Wikström wrote: > On 2007-09-30 18:49, Summercool wrote: >> On Sep 30, 4:18 am, 7stud -- <[EMAIL PROTECTED]> wrote: >>> SpringFlowers AutumnMoon wrote: we have no way of knowing what we pass in could get changed. >>> Sure you do. You look at the function's signature. In order to us

Re: which language allows you to change an argument's value?

2007-09-30 Thread Bryan Olson
Summercool wrote: > I wonder which language allows you to change an argument's value? > like: > > foo(&a) { > a = 3 > } > > n = 1 > print n > > foo(n) # passing in n, not &n > print n > > and now n will be 3. I think C++ and

Re: which language allows you to change an argument's value?

2007-09-30 Thread Michael Fesser
.oO(Summercool) >I think in Pascal and C, we can never have an >argument modified unless we explicitly allow it, by passing in the >pointer (address) of the argument. Pascal also allows passing by reference, which is done with the keyword 'var' when declaring the function parameters. Object Pasca

Re: which language allows you to change an argument's value?

2007-09-30 Thread Jerry Stuckle
Summercool wrote: > On Sep 30, 4:18 am, 7stud -- <[EMAIL PROTECTED]> wrote: >> SpringFlowers AutumnMoon wrote: >>> we have no way >>> of knowing what we pass in could get changed. >> Sure you do. You look at the function's signature. In order to use >> someone else's library, you have to know the

Re: which language allows you to change an argument's value?

2007-09-30 Thread Erik Wikström
On 2007-09-30 18:49, Summercool wrote: > On Sep 30, 4:18 am, 7stud -- <[EMAIL PROTECTED]> wrote: >> SpringFlowers AutumnMoon wrote: >> > we have no way >> > of knowing what we pass in could get changed. >> >> Sure you do. You look at the function's signature. In order to use >> someone else's lib

Re: which language allows you to change an argument's value?

2007-09-30 Thread Daniel Pitts
On Sep 30, 3:47 am, Summercool <[EMAIL PROTECTED]> wrote: > I wonder which language allows you to change an argument's value? > like: > > foo(&a) { > a = 3 > > } > > n = 1 > print n > > foo(n) # passing in n, not &n > print n > &g

Re: which language allows you to change an argument's value?

2007-09-30 Thread Summercool
On Sep 30, 4:18 am, 7stud -- <[EMAIL PROTECTED]> wrote: > SpringFlowers AutumnMoon wrote: > > we have no way > > of knowing what we pass in could get changed. > > Sure you do. You look at the function's signature. In order to use > someone else's library, you have to know the function's signature

Re: which language allows you to change an argument's value?

2007-09-30 Thread Erik Wikström
On 2007-09-30 12:47, Summercool wrote: > I wonder which language allows you to change an argument's value? > like: > > foo(&a) { > a = 3 > } > > n = 1 > print n > > foo(n) # passing in n, not &n > print n > > and now n will be 3. I

Re: which language allows you to change an argument's value?

2007-09-30 Thread Gabriel Genellina
En Sun, 30 Sep 2007 07:47:13 -0300, Summercool <[EMAIL PROTECTED]> escribi�: > I wonder which language allows you to change an argument's value? > like: > > foo(&a) { > a = 3 > } > > n = 1 > print n > > foo(n) # passing in n, not &n >

Re: which language allows you to change an argument's value?

2007-09-30 Thread rolkA
On 30 sep, 12:47, Summercool <[EMAIL PROTECTED]> wrote: > I wonder which language allows you to change an argument's value? > like: > > foo(&a) { > a = 3 > > } > > ... > is there any way to prevent a function from changing the argument's

which language allows you to change an argument's value?

2007-09-30 Thread Summercool
I wonder which language allows you to change an argument's value? like: foo(&a) { a = 3 } n = 1 print n foo(n) # passing in n, not &n print n and now n will be 3. I think C++ and PHP can let you do that, using their reference (alias) mechanism. And C, Python, and Ruby p