[RFC] PIR: const's and identifiers

kjstol parrotcode at gmail.com
Sat Dec 27 20:37:56 UTC 2008


I'm currently implementing/emitting PIR constants (.const) in PBC in PIRC.
Again, I'm running into namespace-like (that is, not .namespace, but
object-type, symbol-like namespaces) issues. What's the desired behavior of:

.const int x = 1

.sub main
 .local int x = 2
print x # what should this print?

.end


IOW, should .const have preference?
It's a minor issue, and not that important, but before I'm putting a lot of
effort in getting things to work, I'd like to get some feedback, and save
myself that trouble.

>From an implementation perspective, it would be easiest, and certainly way
cleaner than any other option, to give .const identifiers first preference.
In that case, the *lexer* can check whether an identifier is a .const.
However, this would imply that .constants would override/hide anything else
with the same name, including ops.

Another option would be to require constant identifiers to be all capitals,
which is not uncommon for constants anyway for many programmers.

comments welcome,

kjs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.parrot.org/pipermail/parrot-dev/attachments/20081227/f33f75d9/attachment.htm 


More information about the parrot-dev mailing list