#1190: Replace .globalconst/.const directives by .const/.localconst
(respectively)
--------------------+-------------------------------------------------------
Reporter: kjs | Owner:
Type: RFC | Status: new
Priority: normal | Milestone:
Component: none | Version: trunk
Severity: medium | Keywords: PIR, .globalconst, .localconst, .const
Lang: | Patch:
Platform: |
--------------------+-------------------------------------------------------
This ticket replaces RT57634.
hi,
in PIR you can use the .globalconst directive in a sub to define a
constant
that is globally accessible.
Likewise, you can use the .const directive in a sub that is local to that
sub.
.sub foo
.globalconst int answer = 42
.const num PI = 3.14
.end
answer in this case is globally accessible (in any other sub, that is
parsed
AFTER the foo subroutine, I should note)
PI in this case is only accessible in this subroutine foo.
However, I question the need for .globalconst, as the .const directive can
also be used /outside/ of a subroutine, like so:
.const int answer = 42
Therefore, the .globalconst directive seems to be superfluous; why have 2
directives that do the same thing; if a .globalconst is accessible
globally
anyway, there's no need to define it WITHIN a sub.
Therefore, my proposal is to remove the .globalconst directive;
whenever you need to have a global const, use .const outside of a
subroutine.
whenever you need to have a local const (in a sub), use .const inside a
subroutine.
comments welcome,
kjs
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1190>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets