the := operator (affectation

Jim MacConnell jmac at consensustech.com
Fri Jun 24 14:00:52 EDT 2005


Dennis,

> My apologies, I was a bit over the top yesterday in my reply.
Thanks... and I was a wee tad over in my response...

> I guess I was a bit too obscure.  The ;-) was the clue that the  
> statements were an example of get, put, gets syntax and a  
> lighthearted jab not meant to be taken too literally:
>
> You just don't "get it", because "get it" is a no op.
> I can't say I can "get it into" your head, because "get...into" is  
> bad syntax mixing left and right assignment, showing the difference  
> between get and put.
> Perhaps Jim gets it now... new syntax of left assignment that is  
> English like syntax.
What a difference a few quotes make. I can hear your "voice" now and  
understand where you were headed. Fine example of dangers of  
interpreting email too literally.... which I am prone to do when  
tired. What appeared to be sarcastic and cynical and rude was in fact  
clever example...

> So in Transcript left assignment might be better stated using the  
> familiar syntax:  set var to x
> The get command becomes the shortcut equivelent of:  set it to
>
> So you see Jim, now I get it!
Or,,, get is a shortcut for "put the propX into it"... the set - put  
difference still rears its head

> I have always been bothered by the left right reversal between  
> setting parameters (just another type of container), and putting  
> into variables.  I have mistyped setting the parameter many times  
> using the form: put x into the parameter of y.  The syntax is not  
> ambiguous as far as I can tell.  Perhaps both set and put syntaxes  
> should be regularized to allow either, and relegate parameters to  
> the ordinary family of containers.  At least allow the setting of  
> variables even if putting into parameters is kept exclusive.
>
> Comments?
When phrased this way, the left - right assignment  question becomes  
one, not of ":=", "=>", etc. but rather........  Why can't I "set a  
variable to x?"  and why can't I "put something into a property?" ..  
that's simple enough for even me to get ;-{)

Off the top of my head there are significant differences between  
variables and properties: persistence (properties stay there when you  
shut down), scope (you can access any property from anywhere whereas  
variables must be explicitly defined as global and then are available  
only if the stack is running and has assigned them a value) and  
messaging (objects can respond to a change in their properties  
(setProp & getProp)). Is that enough to justify a syntax change for  
addressing them.... Hmmmm?

It may be that last item that is key.
"Set" sends a message to an object.... the one with the property...  
and that object can react to that message appropriately with setProp/ 
getProp
"Put" doesn't send a message anywhere... well.. execpt for the fact  
that the object responds to a "put the propX into var" anyway with a  
"call" to getProp
So why couldn't an object respond to a "put var into the propX" with  
the setProp structure...  it could......
So maybe it doesn't matter? Am I coming around to a different  
perspective?

Of course.. none of this has to anything to do with assignment  
operators...

Jim



More information about the use-livecode mailing list