hi,

I have some trouble indexing hashtables.

I have the following code snippet:

.sub main
        .local pmc x
        x = new .Hash

        .local pmc y
        y  = new .Hash
        x["y"] = y

        $P10 = new .Integer
        $P10 = 1
        
        x["y;a"] = $P10 # (1) this does not work with the code below
        y["a"] = $P10 # (2) this does work with the code below
        
        # accessing x.y.a in 2 steps
        $P99 = x["y"]
        $P98 = $P99["a"]
        printerr $P98

        end
.end


x.y.a = 1;
print(x.y.a);

x and y are both hashtables.
x has a field "y", storing y
y has a field "a", storing an integer

I'd like to get the field "a" step by step, so first get a reference to x.y, then get a reference to y.a, instead of indexing at once with "y;a" as done at (2). Doing it step by step makes generating code a bit easier, in my opinion.

I'm wondering what I'm doing wrong, because it looks like it should be working (right?)

regards,
klaas-jan

Reply via email to