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

Re: [perl #129068] SV *Perl_cv_const_sv_or_av(const CV *const):Assertion `((svtype)((cv)->sv_flags & 0xff)) == SVt_PVCV ||((svtype)((cv)->sv_flags & 0xff)) == SVt_PVFM' failed (op.c:7926)

Thread Previous | Thread Next
From:
Zefram
Date:
March 28, 2017 23:17
Subject:
Re: [perl #129068] SV *Perl_cv_const_sv_or_av(const CV *const):Assertion `((svtype)((cv)->sv_flags & 0xff)) == SVt_PVCV ||((svtype)((cv)->sv_flags & 0xff)) == SVt_PVFM' failed (op.c:7926)
Message ID:
20170328231658.GL6453@fysh.org
Dave Mitchell wrote:
>Is there any reason why a my() list can't be enforced (in a strict manner)
>by the lexer / grammar itself rather than post-hoc by optree inspection?

If we were building this from scratch then grammatical enforcement
would clearly be a good idea, with only the minor downside that we
need to duplicate the productions for list syntax.  Having already
got into the present state, though, we can't just casually change it.
It's still a good direction to go in, but we'd need a deprecation cycle,
in case anyone is using syntactically strange stuff to legitimate effect.
I can't imagine that there's any usage in that category that we'd actually
want to preserve.

A deprecation to narrow a grammatical production like this is a tricky
thing to arrange.  perl is not able to retry parsing of arbritrary
code.  I fear that we would need to duplicate a lot of the expression
productions, putting deprecation warnings on all the productions other
than the small group of approved items.  It would be way more hassle
than the qw-as-list deprecation of a few years ago.

A grammatical restriction on the list content would sort out these issues
with conditionals and subroutines.  There might remain issues with being
able to sneak stuff into single "my" items, although I wasn't able to
find such a problem.  If one turns up, we could do a similar deprecation
to narrow the syntax of what's permitted in each "my" item.

-zefram

Thread Previous | Thread Next


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