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:
Dave Mitchell
Date:
March 28, 2017 15:40
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:
20170328154016.GA3342@iabyn.com
On Sun, Jan 29, 2017 at 02:27:31AM +0000, Zefram wrote:
> Where a single item is being lexicalised, as in "my $x", the item is
> syntactically required to be a scalar, array, or hash.  Thus "my &z"
> is rejected early on.  But where a parenthesised list of items is being
> lexicalised, the syntax permits the parens to contain any expression
> whatsoever.  The restriction on what can be lexicalised is instead
> implemented by walking the optree of the completed list, checking that
> it semantically only contains acceptable items.  Hence this difference
> in diagnostics:
> 
> $ ./perl -le 'my &z'
> syntax error at -e line 1, near "my &z"
> Execution of -e aborted due to compilation errors.
> $ ./perl -le 'my(&z)'
> Can't declare subroutine entry in "my" at -e line 1, at EOF
> Execution of -e aborted due to compilation errors.

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?

-- 
"Foul and greedy Dwarf - you have eaten the last candle."
    -- "Hordes of the Things", BBC Radio.

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