develooper Front page | perl.perl5.porters | Postings from October 2014

Re: [perl #123069] signature/attribute syntax is awful

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
October 28, 2014 23:42
Subject:
Re: [perl #123069] signature/attribute syntax is awful
Message ID:
CAHhgV8i1eP7SksXNSVvPoaR+prpf8ZoKx+reNbm+AAXMOo-6-Q@mail.gmail.com
On Mon, Oct 27, 2014 at 11:29 PM, l.mai@web.de <perlbug-followup@perl.org>
wrote:

> The syntax 'sub foo :attributes ($signature) { ... }' is awful. It should
> be 'sub foo($signature) :attributes { ... }'. (This might be a candidate
> for bug #121481.)
>
> Why? Because syntactically the signature replaces what used to be the
> prototype, and that comes before attributes. It's also what all signature
> modules on CPAN implement.
>
> It's also what perl itself does in C. :-)
>
>   OP* Perl_newDEFSVOP(pTHX) __attribute__((warn_unused_result));
>
> not
>
>   OP* Perl_newDEFSVOP __attribute__((warn_unused_result)) (pTHX);
>
> (I have no idea if that would even parse.)
>

I agree that feels more natural (), but this also feels like a highly
subjective thing. IMO, ideally we'd allow both variations (because why
wouldn't we?).

Leon

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