Hi, all. I've been following Parrot development and
been playing with Parrot for a...bout a year and a
half, now. First time posting to the list, though, so
forgive me if this has already been covered or is
stupid in some way :-)
Anyway, while playing around with IMCC, this kind of
bugged me:
P3 = 32 # tells the PMC referenced by P3 to
set its value to 32
P3 = P5 # copies reference in P5 to P3
What I don't like about this is that it's not
immediately obvious from looking at the code whether
you're telling P3 to change its value or simply
replace the PMC reference stored in P3 with another.
As I understand it, this is how it works at
the assmbly level:
set Px, Iy # alters the PMC referenced by Px
set Px, Py # only copies a reference
assign Px, Py # alters the PMC referenced by Px
Whether you copy a reference or just tell the
referenced object to change itself depends
on the type of the operands. It would be less
confusing if you had to be explicit about what
you were doing:
assign Px, 3 # Tells Px to set its value to 3
set Px, 3 # Compile error. You can't
set a PMC reference to an int! WTF?
Similarly,
set Sx, Ix
would barf on you, while
assign Sx, Ix
would do what you want, and
set Sx, Sy
would still be perfectly legal. And
assign Ix, Iy
would throw a fit because you cannot really
'change' an integer, but only replace
it with another, and
set Ix, Iy
would still be correct.
So: "set" would consistantly copy references,
while "assign" asks the object currently
referenced to change its value, somehow.
perhaps PASM's "set" <=> IMCC's "=", while
PASM's "assign" <=> IMCC's "<=" or something :-P
Once again, sorry if this is dumb.
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com