Re: Parentheses

2003-12-15 Thread Steve Grazzini
On Dec 14, 2003, at 9:20 AM, Rob Dixon wrote: Steve Grazzini wrote: Actually, $_ isn't localized by 'while(<>)': % echo test | perl -le 'for ("const") { print while <> }' Modification of a read-only value attempted at -e line 1. Which occasionally jumps up and bites people. Thanks for th

Re: Parentheses

2003-12-14 Thread R. Joseph Newton
Rob Dixon wrote: > R. Joseph Newton wrote: > > > > Rob Dixon wrote: > > > ...has the same effect as printing from inside the loop. > > Which means that my array contents > > > > have either been effectively modified, or totally hashed, > > depending on whether that was the desired effect. > > ..ex

Re: Parentheses

2003-12-14 Thread Rob Dixon
R. Joseph Newton wrote: > > Rob Dixon wrote: > > > > foreach (@lines) { > > # too many lines here > > > > } > > > > > > While the purpose of the above may bve totally > > > incomprehesible, there is no question about what $_ is. <;:-o) > > > > One proviso here. I always feel very uncomfortable ab

Re: Parentheses

2003-12-14 Thread Rob Dixon
Steve Grazzini wrote: > > On Dec 13, 2003, at 9:07 AM, Rob Dixon wrote: > > As a final thought, I would point out that $_ is a package ('our') > > variable, but is localised by 'map', 'grep', 'foreach (LIST)' and > > 'while (<>)'. > > Actually, $_ isn't localized by 'while(<>)': > > % echo te

Re: Parentheses

2003-12-14 Thread Steve Grazzini
[ Remailed to the list (sorry about that, Rob) ] On Dec 13, 2003, at 9:07 AM, Rob Dixon wrote: As a final thought, I would point out that $_ is a package ('our') variable, but is localised by 'map', 'grep', 'foreach (LIST)' and 'while (<>)'. Actually, $_ isn't localized by 'while(<>)': % echo

Re: Parentheses

2003-12-13 Thread drieux
Thought I would propose one more argument on the 'importance' of parens and subs. While putting together I of course had my usual devolutions, because It is easier, for me, to put a RegEx in a function that I will call twice, th

Re: Parentheses

2003-12-13 Thread R. Joseph Newton
Rob Dixon wrote: > > foreach (@lines) { # too many lines here > > } > > > > While the purpose of the above may bve totally incomprehesible, there is no > > question about what $_ is. <;:-o) > > One proviso here. I always feel very uncomfortable about explicitly assigning > to $_. As I implied

Re: Parentheses

2003-12-13 Thread Wiggins d'Anconia
Rob Dixon wrote: R. Joseph Newton wrote: Rob Dixon wrote: Not sure which way you're leaning here. I never saw you as anti the 'it' variable $_? Rob I think its a matter of context, Rob. I agree 100%. But see later. What I cringe at is seeing a default variable being used in dense code. The m

Re: Parentheses

2003-12-13 Thread Rob Dixon
R. Joseph Newton wrote: > > Rob Dixon wrote: > > > > Not sure which way you're leaning here. I never saw you as anti the 'it' > > variable $_? > > > > Rob > > I think its a matter of context, Rob. I agree 100%. But see later. > What I cringe at is seeing a default > variable being used in dense c

Re: Parentheses

2003-12-12 Thread R. Joseph Newton
Rob Dixon wrote: > Wiggins D Anconia wrote: > > > > > Tom Kinzer wrote: > > > > > > > > as a matter of style, i think always having them is nice for > > > > maintenance/readability. > > > > > > I may be wrong, but I think most Perl programmers would disagree. > > > > > > It may be nice for mainten

Re: Parentheses

2003-12-12 Thread drieux
On Dec 12, 2003, at 2:23 PM, Rob Dixon wrote: [..] That I disagree. [..] not a problem. If anything it gives us something to do. In my own case it helped me go back over the technical distinctions again, and work out how much of my 'habit' of using parens with subs is driven by mere left over c-c

Re: Parentheses

2003-12-12 Thread Rob Dixon
Hi Drieux. Drieux wrote: > > On Dec 12, 2003, at 12:18 PM, Rob Dixon wrote: > [..] > > > > Erm, do you agree with me or not? > > yes and NO! [snip] > So props for neatish illustrative code. But given > the generalized assertions about it being a list > operator, one would have expected-ish > > m

Re: Parentheses

2003-12-12 Thread drieux
On Dec 12, 2003, at 12:18 PM, Rob Dixon wrote: [..] Erm, do you agree with me or not? Rob yes and NO! The yes part being that there are times and places where good perl coders know which rules to break and why. Hence, gosh there is that assertion no strict 'refs'; The No Part will take a bit of

Re: Parentheses

2003-12-12 Thread Wiggins d Anconia
> Wiggins D Anconia wrote: > > > > > Tom Kinzer wrote: > > > > > > > > as a matter of style, i think always having them is nice for > > > > maintenance/readability. > > > > > > I may be wrong, but I think most Perl programmers would disagree. > > > > > > It may be nice for maintenance if your progr

Re: Parentheses

2003-12-12 Thread Rob Dixon
Drieux wrote: > [snip] > > "You can have My Prolog Compiler! > when You Rip It From My Cold Dead Hand!" > - (drieux (still in (therapy(issues(resolving(attack(roundies(make > angst Erm, do you agree with me or not? Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comman

Re: Parentheses

2003-12-12 Thread drieux
On Dec 12, 2003, at 10:29 AM, Rob Dixon wrote: Tom Kinzer wrote: as a matter of style, i think always having them is nice for maintenance/readability. I may be wrong, but I think most Perl programmers would disagree. [..] ( (start flame) ( rob you spawn of (under nice) who (hates roundies)

Re: Parentheses

2003-12-12 Thread Rob Dixon
Wiggins D Anconia wrote: > > > Tom Kinzer wrote: > > > > > > as a matter of style, i think always having them is nice for > > > maintenance/readability. > > > > I may be wrong, but I think most Perl programmers would disagree. > > > > It may be nice for maintenance if your program is to be maintain

Re: Parentheses

2003-12-12 Thread Wiggins d Anconia
> Tom Kinzer wrote: > > > > as a matter of style, i think always having them is nice for > > maintenance/readability. > > I may be wrong, but I think most Perl programmers would disagree. > > It may be nice for maintenance if your program is to be maintained > by a herd of Prolog programmers, b

Re: Parentheses

2003-12-12 Thread Rob Dixon
Tom Kinzer wrote: > > as a matter of style, i think always having them is nice for > maintenance/readability. I may be wrong, but I think most Perl programmers would disagree. It may be nice for maintenance if your program is to be maintained by a herd of Prolog programmers, but readability is ce

RE: Parentheses

2003-12-12 Thread Tom Kinzer
as a matter of style, i think always having them is nice for maintenance/readability. -Tom Kinzer -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 8:08 AM To: [EMAIL PROTECTED] Subject: Re: Parentheses Paul Kraus wrote: > > Ok a

Re: Parentheses

2003-12-12 Thread Rob Dixon
Paul Kraus wrote: > > Ok another question on perl then. When do you have to use () on a > function or sub call? Or in the new construct of an object. > I use then on everything since I don't better. Figure its safer to leave > them on then take them off. Very simply, if you've previously declared