| To: | "Allison Randal" <allison@perl.org> |
|---|---|
| Subject: | Re: [svn:parrot-pdd] r30569 - trunk/docs/pdds |
| From: | "Klaas-Jan Stol" <parrotcode@gmail.com> |
| Date: | Fri, 29 Aug 2008 11:06:14 +0200 |
| Cc: | kjs@cvs.perl.org, perl6-internals@perl.org |
| Delivered-to: | mailing list perl6-all@perl.org |
| Delivered-to: | perl6-all-poster@perl.org |
| Delivered-to: | mailing list perl6-internals@perl.org |
| Delivered-to: | perl6-internals@perl.org |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=sanASy4CH80+PWZYJHsuxmtuS8i+r/clhvnwLMwuECc=; b=Nja/QaPaXRSKxv3MgA9OKY0C58liNFYxPo4TccFHGD0RNUHd31NPygceBM2Y4bobmM noq2pqDFmd7VY+OxtApkTawNq+YEZReHA9GeZ08N7UpuQqJcEmJItfSZhYozUgM7uC7N FK43QB/g1fsnn0FRUCy2T4izMcSVfQoFCtIPg= |
| Domainkey-signature: | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=bhgUJghDzjwG92jSx2PymkJw7xYgl0EFEQHpGYkZZmZU6LnkXs2FvVjrmAqkHDpwke 0YqKnKNkbsA3tCeALxT+V4h9ho+wl/hivy1029UihaENQAJAqzbCGN8XbXQj2y80ofNN beLkJ5FysQgkGOxT1slOko+LtwRYgi+dlw4y4= |
| In-reply-to: | <48B7058E.3010802@perl.org> |
| List-help: | <mailto:perl6-all-help@perl.org> |
| List-id: | <perl6-all.perl.org> |
| List-id: | <perl6-internals.perl.org> |
| List-post: | <mailto:perl6-all@perl.org> |
| List-subscribe: | <mailto:perl6-all-subscribe@perl.org> |
| List-unsubscribe: | <mailto:perl6-all-unsubscribe@perl.org> |
| Mailing-list: | contact perl6-all-help@perl.org; run by ezmlm |
| References: | <20080826112756.2821CCB9DD@x12.develooper.com> <48B7058E.3010802@perl.org> |
On Thu, Aug 28, 2008 at 10:07 PM, Allison Randal <allison@perl.org> wrote: > kjs@cvs.perl.org wrote: > >> Opcode names are not reserved words in PIR, and may be used as variable >> names. >> For example, you can define a local variable named C<print>. [See RT >> #24251] >> +Note that by using an opcode name as a local variable name, the variable >> will >> +I<hide> the opcode name, effectively making the opcode unusable. Opcode >> names >> +used as subroutine identifiers, on the other hand, will I<hide> that >> opcode. >> -PIR keywords, on the other hand, I<are> reserved, and cannot be used as >> +In contrast to opcode names, PIR keywords I<are> reserved, and cannot be >> used as >> identifiers. Some opcode names (C<if>, C<unless>) are, in fact, PIR >> keywords, >> which therefore cannot be used as identifiers. >> > > This is another one of those muddy cases in PIR where words conflict when > they shouldn't. I can't think of any way that it's actually useful to have a > variable named 'add' prevent you from using the opcode 'add'. Call it a bug, > or at least a misfeature caused by limited parsing. > > Allison I see what you mean, but being able to do what you would like, would be very complex to implement and IMHO not worth the effort (probably something like setting flags like and lexer code such as: 'if (strcmp(yytext, "add") && expect_math_op) return TK_ADD;'. No fun. Having a rule that says that any local variable declared, hides any other object by the same name in the current scope, is not too hard to understand. In any case, having a local id called 'add' would be a bad practice any way, IMHO. kjs |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [perl #58410] [TODO] Deprecate n_* variants of the math opcodes, Allison Randal |
|---|---|
| Next by Date: | Re: [svn:parrot-pdd] r30620 - trunk/docs/pdds/draft, Allison Randal |
| Previous by Thread: | [svn:parrot-pdd] r30569 - trunk/docs/pdds, kjs |
| Next by Thread: | Re: [svn:parrot-pdd] r30569 - trunk/docs/pdds, Klaas-Jan Stol |
| Indexes: | [Date] [Thread] [Top] [All Lists] |