develooper Front page | perl.perl5.porters | Postings from January 2017

Re: [perl #113936] goto in format

From:
Zefram
Date:
January 23, 2017 22:53
Subject:
Re: [perl #113936] goto in format
Message ID:
20170123225314.GY6507@fysh.org
It's easy enough to postpone the pseudo-block check until after the search
for the label at the format's top level, as I did for multicalled subs
in 3c157b3cf0631c69ffa5aa2d55b9199bf93b22a9.  But although that *permits*
gotos at that level, labels at top level don't actually work.

The op_unscope() process nulls out all the top-level cops, including
those bearing labels, so the labels are invisible.  Perhaps op_unscope()
should decline to null out cops that have labels, or decline to do
anything if there are any labels, but any arrangement of this nature
raises the spectre of labels effectively changing unrelated semantics.
Without top-level labels, a goto that reaches top level can only be used
to jump to labels nested inside block constructs, a deprecated usage.
I don't think it's useful to enable that on its own.

The usefulness of any kind of goto between elements of a format list is
very dubious.  Simple uses tend to result in values being put into the
wrong output fields.

So, should we make labels work at the top level, or should we just
deprecate the use of goto at the top level of formats?

-zefram



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About