Re: Passing arguments by value

2005-12-15 Thread DZ-Jay
[EMAIL PROTECTED] wrote: I've been following this debate all week and noticed one thing missing... No-one has mentioned that it's bad programming practice to rely on a sub to modify an argument. If you want to modify a value, it should be explicitly returned, viz.: sub add_one { my $in_var =

Re: Passing arguments by value

2005-12-14 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: > Content-Type: multipart/mixed; boundary [...] Switch off the HTML, and stop top-posting and cross-posting. -- Affijn, Ruud "Gewoon is een tijger." ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubs

Re: Passing arguments by value

2005-12-14 Thread Deane . Rothenmaier
PROTECTED] 12/13/2005 21:19                 To:                 cc:        , <[EMAIL PROTECTED]>         Subject:        Passing arguments by value -Original Message- On Behalf Of John W. Kennedy Sent: Tuesday, December 13, 2005 1:31 PM Subject: [lists] Re: Passing arguments by valu

Re: Passing arguments by value

2005-12-14 Thread Deane . Rothenmaier
"John W. Kennedy" <[EMAIL PROTECTED]> 12/13/2005 15:30                 To:        [EMAIL PROTECTED]         cc:        Peter Scott <[EMAIL PROTECTED]>, [EMAIL PROTECTED], activeperl@listserv.ActiveState.com         Subject:        Re: Passing arguments by value [EMAIL PROTECTE

RE: Passing arguments by value

2005-12-13 Thread Jan Dubois
On Tue, 13 Dec 2005, R. S. van Keuren wrote: > W. Kennedy Sent wrote: > > There are languages and cultures in which that applies, and others > > in which it does not. Perl is not clearly on the one side or the > > other. > > It is a common practice in many languages to pass a pointer to a > structu

Re: Passing arguments by value

2005-12-13 Thread Anthony R. Nemmer
alf Of John W. Kennedy Sent: Tuesday, December 13, 2005 1:31 PM Subject: [lists] Re: Passing arguments by value [EMAIL PROTECTED] wrote: I've been following this debate all week and noticed one thing missing... No-one has mentioned that it's bad programming practice to rely on a su

Passing arguments by value

2005-12-13 Thread R. S. van Keuren
-Original Message- On Behalf Of John W. Kennedy Sent: Tuesday, December 13, 2005 1:31 PM Subject: [lists] Re: Passing arguments by value [EMAIL PROTECTED] wrote: > > I've been following this debate all week and noticed one thing > missing... No-one has mentioned

Re: Passing arguments by value

2005-12-13 Thread John W. Kennedy
[EMAIL PROTECTED] wrote: I've been following this debate all week and noticed one thing missing... No-one has mentioned that it's bad programming practice to rely on a sub to modify an argument. If you want to modify a value, it should be explicitly returned, viz.: sub add_one { my $in_var

Re: Passing arguments by value

2005-12-13 Thread $Bill Luebkert
David Nicol wrote: > Is anyone besides $Bill Luebkert confused by the suggestion in perldoc that > passing a perl reference to a container is the way to keep the container > from getting flattened, to the point that the doc would benefit from a > rewrite? Are you insinuating that I'm confused by

Re: Passing arguments by value

2005-12-13 Thread David Nicol
Is anyone besides $Bill Luebkert confused by the suggestion in perldoc that passing a perl reference to a container is the way to keep the container from getting flattened, to the point that the doc would benefit from a rewrite? -- David L Nicol I'll see your time division multiplexing and raise y

Re: Passing arguments by value

2005-12-13 Thread Deane . Rothenmaier
I've been following this debate all week and noticed one thing missing... No-one has mentioned that it's bad programming practice to rely on a sub to modify an argument. If you want to modify a value, it should be explicitly returned, viz.: sub add_one { my $in_var = shift;    return( ++$in_var

Re: Passing arguments by value

2005-12-13 Thread Peter Scott
On Mon, 12 Dec 2005 10:50:44 -0800, $Bill Luebkert wrote: > Peter Scott wrote: >> On Sun, 11 Dec 2005 21:32:09 -0800, $Bill Luebkert wrote: > >> No we aren't. The phrase "pass by reference" is a computer science term >> that predates the invention of Perl. The word "reference" therein does >> n

Re: Passing arguments by value

2005-12-12 Thread $Bill Luebkert
Peter Scott wrote: > No we aren't. The phrase "pass by reference" is a computer science term > that predates the invention of Perl. And which applies to *compiled* programs where vrbls have a descreet location. > The word "reference" therein does > not refe

Re: Passing arguments by value

2005-12-12 Thread David Nicol
http://www.google.com/search?q=define%3A+pass+by+reference ___ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Passing arguments by value

2005-12-12 Thread $Bill Luebkert
Peter Scott wrote: > On Sun, 11 Dec 2005 21:32:09 -0800, $Bill Luebkert wrote: > No we aren't. The phrase "pass by reference" is a computer science term > that predates the invention of Perl. The word "reference" therein does > not refer to Perl references but to whether the caller's variable ca

Re: Passing arguments by value

2005-12-12 Thread David Nicol
On 12/12/05, Peter Scott <[EMAIL PROTECTED]> wrote: > On Sun, 11 Dec 2005 21:32:09 -0800, $Bill Luebkert wrote: > > We're talking Perl > > references here. > > No we aren't. The phrase "pass by reference" is a computer science term > that predates the invention of Perl. The word "reference" there

Re: Passing arguments by value

2005-12-12 Thread Peter Scott
On Sun, 11 Dec 2005 21:32:09 -0800, $Bill Luebkert wrote: > David Nicol wrote: > >> On 12/10/05, $Bill Luebkert <[EMAIL PROTECTED]> wrote: >> >>>The fact that you can modify the vrbl passed to a sub from in the sub >>>without using a reference still doesn't mean that it's passed by >>>reference.

Re: Passing arguments by value

2005-12-11 Thread $Bill Luebkert
David Nicol wrote: > On 12/10/05, $Bill Luebkert <[EMAIL PROTECTED]> wrote: > >>The fact that you can modify the vrbl passed to a sub from in the sub without >>using a reference still doesn't mean that it's passed by reference. > > No. You are mistaken. That is exactly what passing by reference

Re: Passing arguments by value

2005-12-11 Thread David Nicol
On 12/10/05, $Bill Luebkert <[EMAIL PROTECTED]> wrote: > Chaddaï Fouché wrote: > > > $Bill Luebkert wrote: > > > > > >>Perl normally passes by value . > >> > > > > That is unaccurate : Perl always passes by reference (or rather by > > alias), but we do the copy ourselves when we handle the argument

Re: Passing arguments by value

2005-12-11 Thread Chaddaï Fouché
$Bill Luebkert wrote: The fact that you can modify the vrbl passed to a sub from in the sub without using a reference still doesn't mean that it's passed by reference. This is a special case that aliasing provides. This could be partially an exercise in semantics though. This aliasing provi

Re: Passing arguments by value

2005-12-10 Thread $Bill Luebkert
Chaddaï Fouché wrote: > $Bill Luebkert wrote: > > >>Perl normally passes by value . >> > > That is unaccurate : Perl always passes by reference (or rather by > alias), but we do the copy ourselves when we handle the arguments array : > @_ always has aliases on the arguments. The fact that Per

Re: Passing arguments by value

2005-12-10 Thread Chaddaï Fouché
$Bill Luebkert wrote: Perl normally passes by value . That is unaccurate : Perl always passes by reference (or rather by alias), but we do the copy ourselves when we handle the arguments array : @_ always has aliases on the arguments. eg : sub increment { $_[0]++ } sub increment2 { my $arg

Re: Passing arguments by value

2005-12-10 Thread DZ-Jay
On Dec 10, 2005, at 05:30, Joseph C. Bautista wrote: Sorry bill for the lack of sample on my part. But I was wondering if its possible to PERL to pass an argument "byref" or "byval" like that of visual basic Perhaps a bit of an explanation will help clarify. Yes, it is possible, though its

Re: Passing arguments by value

2005-12-10 Thread $Bill Luebkert
Joseph C. Bautista wrote: > Sorry bill for the lack of sample on my part. But I was wondering if its > possible to PERL to pass an argument "byref" or "byval" like that of visual > basic whereas if I passed a $one variable as a reference, changes made by > subroutines in the value will reflects in

RE: Passing arguments by value

2005-12-10 Thread Joseph C. Bautista
> Perl normally passes by value - to pass by reference you would explicitly > do so or pass a value that is already a reference. > > EG: > > my $one = 1; > my $oneref = \$one; > > mysub (1);# will pass the value 1 > mysub ($one); > > mysub (\1); # will pass a reference to 1 > mysub (\$o

RE: Passing arguments by value

2005-12-10 Thread Joseph C. Bautista
Joseph C. Bautista Senior Engineer OSS Future Communication Company International, Kuwait Mobile : +965 9394038 Email Add : [EMAIL PROTECTED] URL : www.fcciq8.com Sorry bout this, I should have tried better... > > Ex. (AS REFERENCE) > > { > my $one = 1; > &mysub($one); > > print "value is : $

Re: Passing arguments by value

2005-12-10 Thread $Bill Luebkert
Joseph C. Bautista wrote: > Hi All, > >Is there a way in perl to pass arguments by value? Normally it’s > treating every arguments to be pass as a reference… Perl normally passes by value - to pass by reference you would explicitly do so or pass a value that is already a reference. EG:

Passing arguments by value

2005-12-09 Thread Joseph C. Bautista
Hi All,    Is there a way in perl to pass arguments by value?  Normally it’s treating every arguments to be pass as a reference…    Thank you… Joseph C. Bautista Senior Engineer OSS Future Communication Company International, Kuwait Mobile : +965 9394038 Email A