Thanks for clearing that up. It just seemed really odd when I first took notice of that, giving my background in many over langs like C/C++, Java, Cobol, PL/SQL, etc. I find it a pretty nifty feature actually :) ----- Original Message ----- From: "Brent Dax (via RT)" <perlbug-followup@perl.org> To: <sr@blz.hmrprint.com> Sent: Sunday, September 07, 2003 15:24 PM Subject: RE: [perl #23754] Possible bug?; keywords for sub idenifier? > sr@blz.hmrprint.com (via RT): > # I just wondering, why does Perl allow you to use supposedly reserved > words > # for a sub (function) identifier? > > This is a feature, not a bug. > > Perl allows you to use reserved words as identifiers because there's no > good reason *not* to. Remember, you can call a function with an > ampersand (&), so it's not like there's no way to access a function with > the same name as a reserved word. > > Moreover, it's good for backwards compatibility. How many programs had > functions called lock() before we added threads (and thus locks) to > Perl? People weren't forced to rewrite those programs *because* Perl > allows functions to have the same names as built-ins. > > That's not to say we encourage naming functions after reserved words. I > doubt anybody would call that "good style". But if there's no technical > reason to stop it, why do so? > > --Brent Dax <brent@brentdax.com> > Perl and Parrot hacker > > "Yeah, and my underwear is flame-retardant--that doesn't mean I'm gonna > set myself on fire to prove it."Thread Previous | Thread Next