develooper Front page | perl.perl5.porters | Postings from April 2012

Re: [perl #108286] Wishlist: Overridable keywords

Thread Previous
From:
Eric Brine
Date:
April 22, 2012 19:29
Subject:
Re: [perl #108286] Wishlist: Overridable keywords
Message ID:
CALJW-qGjpnq_G0=g61ZTN2zodcQ5MxG-bjL2uDvWA+691pOCcA@mail.gmail.com
On Sun, Apr 22, 2012 at 4:56 PM, Father Chrysostomos via RT <
perlbug-comment@perl.org> wrote:

> Another way of putting it:  Should there by a sub named CORE::elsif that
> produces a syntax error when inlined?  Or should there be no CORE::elsif
> sub at all, elsif only being treated as a keyword after if(){} or elsif{}?
>
> I’m leaning toward the former right now, as it avoids changing the
> behaviour unnecessarily.
>

Would you recommend this behaviour to someone else? Say someone introduces
a C<< with ... in ... >> statement. Should they override C<< in >> so that
C<< in(); >> is a syntax error?

It's going to be fun telling people that Perl goes out of its way to make
C<< elsif(); >> a syntax error just so users can ask Perl not to make it a
syntax error.

- Eric


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