> Out of curiosity, how does the word
> "assign" imply that it morphs an
> existing value, and how does the word
> "set" imply that it copies a pointer?

Well, I suppose "set" was chosen just because
that seems to be the standard name for an
operation that copies a pointer. Then "assign"
was chosen just to be different from "set" :-)

But they actually do make a bit of sense in
my mind.

"set P1 to P2" sounds like you're replacing
P1 with P2. Which is what happens, since P1
and P2 are just pointers.

"assign to P1 P2"
This seems to imply that you're going to tell
P1 that it's having P2 assigned to it. Like
at work when you get an 'assignment'. They
don't actually change you're value (hopefully),
but just give you something to do. They
'assign' you a job.

Boss: "Bob, I'm going to assign you a desk."
Bob:  "OK"

Boss: "Bob, I'm going to set you to a desk."
Bob:  "What? You're replacing me witha desk?!"

(Well, that's what I would say if I was Bob ;) YMMV)

Bob would probably object to being morphed to
a desk, as well. Actually I think "morph" is
not quite as appropriate as "assign", as
"morph" sounds like you're going to change the
type of the thing, while "assign" seems to imply
that the thing can do whatever it wants with the
new value.

if you assign an integer to a PerlString, it's
still a PerlString. But if you morph a PerlString
into an integer, it sounds like you're changing
the PerlString itself into an integer.

Also, 'assign' may be used (well I don't know,
but this would make sense) on
objects that represent variables. When you
'assign' the variable a value, you don't
really change the variable, itself, as would
be implied by "morph".

<slight-subject-change>

Personally, I would like "=" to mean 'set', and
maybe "<-" do 'assign'. Probably because I'm
used to thinking of PMC registers as pointers,
and because the kind of languages that I'm
used to (Java, Python, Ruby) all treat variables
as pointers, so '=' just copies pointers. I
think that people probably do more setting than
assigning, anyway, so keeping the set operator
short is good for that reason, too.

"<-" even looks like 'put into', which is pretty
much what you're doing when you say "P1 <- 3".
Yeah. I like that :-D

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Reply via email to