On Sat, 23 Apr 2005 07:25:10 -0400, Juerd <[EMAIL PROTECTED]> wrote:
Matt skribis 2005-04-22 21:55 (-0400):
What about . for each level up you want to go? instead of 1.say, 2.say, 3.say you use .say, ..say, ...say (Ok, I'm just kidding.. really!)
I read your message after I suggested the same thing (I'm too impatient to read all new messages before sending replies).
Why were you just kidding? I think it's a great idea.
Well I like it too. I just didn't think anyone would actually go for it. I guess I underestimated how crazy you guys are ;)
After some further thought (and a phone talk with Larry), I now think
that all of these counted-level solutions (even my proposal of _2.foo(),
etc.) are a bad idea. They have a similar problems to constructs like
"next 5;" meaning jump to the next iteration of the loop 5 level out.
Any time you refactor you code and change levels, they break in a
subtle and very hard to debug way, causing mysterious errors. Just like
the current Perl construct of "labeled loops" so that you can talk about
the target loop explicitly, the proper solution for up-level access to
$OUTER::OUTER::...::OUTER::_ is to create a named binding like
"$uplevel_topic := $_;" at that upper level and then use that to refer to it at lower levels. Beside is ".......foo();" seven of eight levels
up? Any other way than explicit naming is madness; leading to
unreadable and unmaintainable code.
-- [EMAIL PROTECTED] [EMAIL PROTECTED]