develooper Front page | perl.perl5.porters | Postings from September 2013

[perl #119251] [PATCH] Enhancement request - a prototype attribute

Thread Previous
From:
Father Chrysostomos via RT
Date:
September 17, 2013 21:16
Subject:
[perl #119251] [PATCH] Enhancement request - a prototype attribute
Message ID:
rt-3.6.HEAD-1873-1379452550-1473.119251-15-0@perl.org
On Mon Sep 16 23:10:19 2013, pcm wrote:
> On Wed, Aug 14, 2013 at 2:54 AM, Father Chrysostomos via RT
> <perlbug-followup@perl.org> wrote:
> > Second patch:
> >
> > $ ./miniperl -e 'sub f { use }'
> > Assertion failed: (name), function S_move_proto_attr, file op.c,
> line 2578.
> > Abort trap: 6
> 
> I'm getting:
> 
> [pmartini@pmlenlaptop blah]$ ./miniperl -e 'sub f { use }'
> syntax error at -e line 1, near "use }"
> Execution of -e aborted due to compilation errors.
> 
> If you apply the original second patch now, do you still see the
> error?

With your *new* patch, I still get that result.  Are you compiling with
-DDEBUGGING?  (If not, make sure to delete config.sh and Policy.sh
before re-running Configure.)

Please note the comment that I added to ck_subr in 3a74e0e282 (you may
find the commit message informative, too):

+           /* After a syntax error in a lexical sub, the cv that
+              rv2cv_op_cv returns may be a nameless stub. */
+           if (!hek) return ck_entersub_args_list(o);;

Also:

# Failed test 28 - Multiple prototype declarations warns at
op/attrproto.t line 77
#      got 'Attribute prototype($$$) discards earlier prototype
attribute in same sub at (eval 14) line 1.
# '
# expected /attribute prototype\(\$\$\$\) discards earlier prototype
attribute in same sub/
op/attrproto.t ....................................................
Failed 1/48 subtests 

I think the test is wrong here.  Should be a capital A.

Also, if you are going to pass a GV straight into validate_proto, it
needs to handle GVs and not print the asterisk:

$ ./perl -Ilib -lwe 'use attributes __PACKAGE__, \&foo, "prototype([)"'
Missing ']' in prototype for *main::foo : [ at lib/attributes.pm line 33.
Prototype mismatch: sub main::foo: none vs ([) at lib/attributes.pm line 33.

Maybe validate_proto should call the cv_name we discussed earlier, and
that will be an excuse for adding it. :-)

These are just the first few things I have noticed.  I have not
scrutinized your new patches yet.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=119251

Thread Previous


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