On Sat, 23 Apr 2005 13:55:17 -0400, Mark A. Biggar <[EMAIL PROTECTED]> wrote:

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.

Hm.. didn't really think of that. Though, how often would that really happen? You can just explicility refer to the topic if you refactor. So long as there is another way, I'm not sure that problem constitutes not putting in such a shortcut.

I do see this as a being a bit confusing though:

        given open 'file a' {
                given open 'file b' {
                        given open 'file c' {

Doesn't that just encourage writing confusing code? Also, does anyone else initial read it as doing say on file a first, then b, then c; instead of c, b, a?

Reply via email to