On Mar 12, 2006, at 2:55, Joshua Isom wrote:

If the compiler goes through all the constants at compile time to find identical ones, why not use ".const float number = 0.0"?

That covers only a small part of the problem. 'Const's are still mutable, they still morph, and PMCs with the same value don't have the same .id. While Parrot PMCs pretend to be values too, they are much more like vars.

irb(main):002:0> 2.id
=> 5
irb(main):003:0> (1+1).id
=> 5

$ cat c.pir
.sub main :main
    .const .Integer i = "42"
    print i
    print "\n"
    inc i
    print i
    print "\n"
    i = 3.14
    print i
    print "\n"
.end

$ ./parrot c.pir
42
43
3.14

leo

Reply via email to