Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
analogy pmc/content with inode/file
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Stéphane Payrard  
View profile  
 More options Oct 26 2004, 10:42 am
Newsgroups: perl.perl6.internals
From: s...@payrard.net (Stéphane Payrard)
Date: Tue, 26 Oct 2004 16:42:53 +0200
Local: Tues, Oct 26 2004 10:42 am
Subject: analogy pmc/content with inode/file
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.

C<set_pmc>, when the destination pmc is a reference, is like
creating a symbolic link with the difference that there cannot
dangling reference pmc thanks to reference counting.

C<assign_pmc> is like copying a file to another. After the
assignement the two pmcs and their contents are independant.

Does the analogy holds? or am I mistaken?
I certainly don't pretend that one can carry further the analogy.

--
 stef


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leopold Toetsch  
View profile  
 More options Oct 27 2004, 6:06 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Wed, 27 Oct 2004 12:06:46 +0200
Local: Wed, Oct 27 2004 6:06 am
Subject: Re: analogy pmc/content with inode/file

Stéphane Payrard <s...@payrard.net> 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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dan Sugalski  
View profile  
 More options Oct 27 2004, 9:23 am
Newsgroups: perl.perl6.internals
From: d...@sidhe.org (Dan Sugalski)
Date: Wed, 27 Oct 2004 09:23:54 -0400
Local: Wed, Oct 27 2004 9:23 am
Subject: Re: analogy pmc/content with inode/file
At 12:06 PM +0200 10/27/04, Leopold Toetsch wrote:

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
d...@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »