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

Re: square signatures

Thread Previous | Thread Next
From:
Smylers
Date:
November 15, 2017 11:36
Subject:
Re: square signatures
Message ID:
15fbf742a08.d944b05a53934.8359544685512569269@stripey.com
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
  them

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
up. 

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.

Smylers

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