On Sun May 20 04:41:46 2012, zefram@fysh.org wrote: > Eric Brine wrote: > >PS - Something to test: What happens if one overrides C<elsif> using the > >keyword plugin? Does it break C<if>? > > I think the best way to do this (in the long run) is that the code to > parse the "if" syntax (which is magically attached to &if), when it sees > an identifier in a place that might be an "else" or "elsif", uses the > normal sub name lookup mechanism to decide what it means. Having resolved > the identifier to a sub ref, it checks whether this matches the &else or > &elsif that it knows about, and acts accordingly. &elsif is, of course, > a dummy sub, with parser magic that will just signal an error, because > "elsif" isn't allowed to be used on its own. The result is that you can > change the spelling of "elsif" by doing things like "*orif = \&elsif". > A user-added "if"-alike can use exactly the same mechanism, using either > the standard &elsif or its own dummy subs. Thatâs a nice solution that solves all the problems I brought up.. -- Father Chrysostomos --- via perlbug: queue: perl5 status: open https://rt.perl.org:443/rt3/Ticket/Display.html?id=108286Thread Previous | Thread Next