logo       

Re: analogy pmc/content with inode/file: msg#00563

Subject: Re: analogy pmc/content with inode/file
At 12:06 PM +0200 10/27/04, Leopold Toetsch wrote:
Stéphane Payrard <stef@xxxxxxxxxxx> 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).

Not quite. The PMC is the variable, not the value. The contents of the PMC are the value.

It depends on the HLL, what e.g. an
assignment is doing:

These aren't all assignment, and the chosen punctuation is really unfortunate.

  i = j   # Python - both variables refer to the same value

This isn't assignment. This is name rebinding -- that is, two names in some namespace refer to the same PMC

  i += k  # mutable objects are changed in place
          # immutable objects are rebound to hold the new value

This is one of those bizarre mutant cases -- it's really a method call.

  @a = @b # Perl - copy array

This is assignment, sort of. If you squint hard, given the stuff perl's doing behind the scenes.

In all these it's important to note that in most languages (certainly the ones we care about) objects are *reference* types, not value types. That is, there's a level of indirection (likely an ObjectReference or just generic PMCReference PMC) between the name and the ultimate object structure, something we don't do right now.
--
                                Dan

--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
dan@xxxxxxxxx                         have teddy bears and even
                                      teddy bears get drunk



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe