Stéphane Payrard <[EMAIL PROTECTED]> wrote:
> I want to make an loose analogy between pmc/their_content and
> Unix inodes/files which I use as a mnemonic.

> PMCs are the equivalent of inodes, each one
> reference some content which is the equivalent of a file.

> C<set_pmc>, when the source and the destination pmcs are of the same type,
> is like creating a hard_link to a file. The two pmcs share the
> same content.

,--[ pdd02_vtables.pod ]------------------------------------------
|       void set_pmc(INTERP, PMC* self, PMC* value)
|            Sets the value of the PMC in self to the value of the
|            PMC in value.
|
|        void assign_pmc(INTERP, PMC* self, PMC* value)
|            Sets the value of the PMC in self to the value of the
|            PMC in value by copying the value.
`-----------------------------------------------------------------

So probably yes. OTOH having e.g. two array PMCs pointing to the same
array structure could be rather error prone.

I think, we have to consider first variables vs values. Variables have a
name and hold values (the PMCs). It depends on the HLL, what e.g. an
assignment is doing:

  i = j   # Python - both variables refer to the same value
  i += k  # mutable objects are changed in place
          # immutable objects are rebound to hold the new value
  @a = @b # Perl - copy array

So normally setting a value happens one level higher. But in leaf
functions and in the absence of introspection, I can imagine that the
optimizer converts lexical opcodes to PMC-only operations, depending on
the semantics of the HLL.

leo

Reply via email to