On Saturday, July 13, 2002, at 07:11 , David T-G wrote:
In the main I like where this is generally going. A part of my argument with myself today has been about which is better? all 'teaching code' should be 'virgin clean'??? or should we show the actual process by which ideas mutate from a quick sketch to a 'completed' piece? Far too many times the 'way we learned' a coding language has little to do with how we present the coding language. tell me what you think of http://www.wetware.com/drieux/pbl/perlTrick/CBO/jobBot/ where I am trying to do some of what I think you are asking about in terms of 'if you do foo....' [..] > I think this could be expanded to show use of "local" or "our" vars for > those who *want* to expose $z but must still see the dangers in not using > "my". Just a thought. This has me concerned - it could be the way that the phrase is turned. if one starts with the simple mandate of though shalt use '-w' and 'use strict' then the choices are limited any variable that one would 'local' with, needed to have been declared with my or our remember that 'our' is a 5.6-ism if I recall correctly. So i am not too sure i 'grok' your assertion 'see the dangers in not using "my"' as a contrast to 'our' or 'local'. > This leads me to ruminating on global variables in general. Things like > config vars -- %ENV these are essentially out of your control 'at start up' - if by 'config' you mean the set that are 'built in' and accessible with 'use Config'??? > or a switch that says to do this one way or another > or the like -- seem well suited to being global. the problem is that 'globals are' - there are bunches of them that are defined all over the place - and one therefore wants to 'manage' the problem as best as one can. > Perhaps if declared with an "our" at the main scope level... one advantage of this is that you can establish a reasonable habit of putting them where you know that you can find them... The alternative habit of 'declare them where you need them' - has the reverse 'bite you' problem. while($still_do_me) { ..... my @accumulator ; push(@accumulator, $this); .... } # # why can't I get anything out here # cope_with_them($_) for (@accumulator); what one wanted really was my @accumulator ; while($still_do_me) { ..... push(@accumulator, $this); .... } > Can one safely and sanely make > the argument "thou shalt NEVER have an unadorned variable" or is that > just pushing a little too hard? well.... think about it, the moment that you mandate 'use strict' and '-w' - the code will run, but it will whine without 'adorning' your variables as to whom they belong to.... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]