On Thu, 12 Dec 2002, Leopold Toetsch wrote:

> Simon Glover wrote:
>
> > On Wed, 11 Dec 2002, Dan Sugalski wrote:
> >
> >
> >>Are in. You can now get, set, delete, and get a hash of PMC
> >>properties. (Hopefully)
> >>
> >>Alas, no tests. Working on that, but if someone wants to beat me to
> >>it, feel free.
> >>
> >
> >  I would expect this:
> >
> >         new P0, .PerlInt
> >         new P1, .PerlInt
> >
> >         set S0, "Brown"
> >         set P0, "Yes"
> >         setprop P1, S0, P0
> >
> >         set S0, "Black"
>
>
> hash keys are only referenced not copied into the hash. So you reset
> here the first key to "Black" ...
>

 I see what you mean; changing the code to this:

        new P0, .PerlInt
        new P1, .PerlInt
        new P3, .PerlInt

        set S0, "Brown"
        set P0, "Yes"
        setprop P1, S0, P0

        set S0, "Black"
        set P3, "No"
        setprop P1, S0, P3

        new P2, .PerlString
        getprop P2, "Brown", P1
        print P2
        print "\n"

        getprop P2, "Black", P1
        print P2
        print "\n"

        end

 does indeed print:

  Yes
  No

 This still doesn't answer my question, though: is the fact that the keys
 are passed by reference a bug or a feature?

 Also, the above code (and the original version) still segfaults if I run
 it with --gc-debug.

 Simon

Reply via email to