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

Re: square signatures

Thread Previous | Thread Next
November 15, 2017 11:36
Re: square signatures
Message ID:
Zefram writes:

> Leon Timmermans wrote: 
> > I quite frankly don't care about the advantages for prototypes,
> > they're clearly the wrong thing to optimize for. 
> The motivation is to make signatures and prototypes more distinct.  In
> allocating the delimiter characters, we're constrained by the fact
> that prototypes got there first and bagged parens. 

When teaching Perl, it's relatively straightforward to cover, in order:

• invoking functions using parens round the arguments
• defining functions, using parens round the parameters
• ...
• advanced feature: declaring prototypes, using :prototype to denote

It's more awkward to teach: “When defining functions, you have to use
square brackets around the parameters, not the parens you were expecting
from invoking functions in Perl and from declaring functions in many
other languages, because parens are used for some other, advanced,
feature that you don't need to know about until after we've got the hang
of just declaring functions.” Because the question would definitely crop

The users most burdened by the syntax clash are those who have already
made use of prototypes. They are more advanced users, so should be in a
better position to cope with the conflict than those learning Perl or
who have never used prototypes.


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