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

[perl #108286] Wishlist: Overridable keywords

Thread Next
From:
Father Chrysostomos via RT
Date:
May 14, 2012 22:07
Subject:
[perl #108286] Wishlist: Overridable keywords
Message ID:
rt-3.6.HEAD-4610-1337058415-469.108286-15-0@perl.org
On Sun Apr 22 19:30:13 2012, ikegami@adaelis.com wrote:
> 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.

Given an mistake as easy to make as this:

    if($foo) { };
    else { $bar }

do you think it is acceptable for

    syntax error at - line 2, near "else"
    Execution of - aborted due to compilation errors.

to become

Can't call method "else" on an undefined value at - line 2.

?

Maybe it is.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=108286

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