assignment slots (was: two questions...)
dougo at pure.com
Wed Apr 13 23:46:05 UTC 1994
> Here is another idea for assignments: how about making the assignment
> slot contain actual Self code that calls the special primitive. I
> will use a binary message selector "<-" here, but "_Assign:" would
> work as well. Let us suppose, initially, that this special primitive
> can only be used with an implicit self as receiver and that assignment
> slots are associated with their data slot by name.
> ( | x <- 7 | )
> will mean the same thing as:
> ( | x = 7. x: arg = ( <- arg ) | )
> but we can have more complex assignments:
> ( | x = 7.
> x: arg = ( count: count + 1. <- arg ).
> count <- 0
> | )
This was actually the first thing I tried, until I found out that <-
wasn't a binary selector. I think this is the most intuitive
solution, but I admit I'm still pretty naive about how Self works (wrt
both the syntax and the implementation), and so my intuition may be
biased from having only worked with languages where the assignment
expression is part of the syntax.
Anyway, just wanted to add my support for this idea. I really haven't
been satisfied with any of the other workaround solutions proposed.
Thanks for the attention.
--Doug (dougo at pure.com)
More information about the Self-interest