<?xml version="1.0" encoding="windows-1252"?>
<node id="1013869" title="Re^3: How does 'goto LABEL' search for its label? (work-around)" created="2013-01-17 14:42:51" updated="2013-01-17 14:42:51">
<type id="11">
note</type>
<author id="22609">
tye</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;
just that without it, the implementation of lexpads would be much simpler and saner.
&lt;/i&gt;&lt;/blockquote&gt;&lt;p&gt;
Yeah, that would have been my best guess.  I'm curious about how "much" simplification we are talking about.  But I'll go digging in the p5p archives for more details if I find the time and motivation. :)
&lt;/p&gt;&lt;p&gt;
I wonder if the complications could be avoided by having behavior closer to this pseudo-Perl code:
&lt;/p&gt;&lt;c&gt;
    if( $fatal )
    ERR: {
        ...
    }
&lt;/c&gt;&lt;p&gt;
So that the destination for "goto ERR;" would be the start of the lexical block instead of the first line in the lexical block.
&lt;/p&gt;&lt;p&gt;
It would be nice if a label pointing to the first line of a lexical block could just be moved to point to the start of the lexical block, avoiding the complexity and the need for deprecation.  That is:
&lt;/p&gt;&lt;c&gt;
    if( $fatal ) {
    OK:
        ... no need to deprecate this ...
    }
    if( $fatal ) {
        my $foo;
    BAD:
        ... "goto BAD" from outside this block deprecated ...
    }
&lt;/c&gt;&lt;p&gt;
But, if one ends up using a Perl that has the deprecation but doesn't implement my idea, then it should often be relatively easy to rewrite the code to be more like:
&lt;/p&gt;&lt;c&gt;
    ...
    if( $whatever ) {
        goto ERR;
    }
    ...
    if( $fatal ) {
        # Used to be "ERR:" here
        goto ERR;
    }
    return ...;
ERR:
    ... code moved from if( $fatal ) ...
&lt;/c&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-22609"&gt;&lt;p align="right"&gt;
- [tye]&lt;tt&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/tt&gt;
&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1013574</field>
<field name="parent_node">
1013834</field>
</data>
</node>
