NAME ^

PGE::RegCounter - A register naming manager

SYNOPSIS ^

    # creation (only once; you usually call "next")
    .local pmc new_rc
    .local pmc rc
    find_global new_rc, "PGE::RegCounter", "new"
    rc = new_rc()

    # declare the registers you're going to use
    rc.declare("answer", "$I")

    # and use them
    print rc["answer"]
    print " = 41\n"
    print "inc "
    print rc["answer"]
    print "\n"

    # and pass on a child counter to a subroutine
    $P0 = rc.next()
    generate_foo($P0)
    # generate_foo() now has a clean lexical space to work with


parrot