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

Re: square signatures

Thread Previous | Thread Next
Tomasz Konojacki
November 15, 2017 01:16
Re: square signatures
Message ID:
On Mon, 13 Nov 2017 20:07:00 +0000
Zefram <> wrote:

> * can immediately see whether you're looking at a prototype or a
>   signature, not having to consider pragmata

> * prototype and signature more mentally distinct

IMO :prototype() makes them *much* more distinct.

> * nicer syntax for prototypes when signatures are enabled

I'd argue that :prototype() is the nicer syntax, because:

1. It's more explicit and it's googleable, which is important in case of
a rarely used feature.

2. It's more consistent. Prototype is nothing else than an attribute of
a subroutine, so it shouldn't be treated differently than :lvalue or

> * enabling signature syntax (in one file, or as a "use 5.030" bundle)
>   doesn't break the old prototype syntax in existing code

I don't think that it's important. In a typical codebase, prototypes are
used in a tiny minority of functions. Converting them to :prototype()
should take no more than a few minutes.

Even in the most extreme case of CPAN modules from the List::* namespace,
it still isn't a lot of work.

If for some unlikely reason you can't update your prototypes to the new
syntax, don't enable signatures. That's the whole point of

> * documentation that gives examples using prototypes doesn't need any
>   complexification
> Cons:
> * looks a bit weird

I'm sorry, but "a bit weird" is an understatement. This syntax looks
completely alien. I agree with Leon, anything else than our current
syntax is counter-intuitive.

> * all existing signature-using code (which either emits or explicitly
>   muffles a "signatures are experimental" warning) needs to change
> Let the opinions flow.
> -zefram

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About