[Grace-core] Edited Variable & Constant page
Andrew P. Black
black at cs.pdx.edu
Tue Nov 16 00:51:24 PST 2010
>
> yep I know. Self object literals look like: (| varslot. varslot <- initvalue. constslot = initvalue |)
> Then in self blocks, say, one can write [ : arg1 :arg2 | varslot. varslot <- initvalue. constslot = initvalue | code]
> (the local defs between the two | | are optional).
It took me twenty years to understand the Simula view of things: that object are just activation records that outlive their callers. In that view, fields and temps are indeed the same thing.
Thank God, Alan Kay both understood the power of Simula, and was able to explain it to the rest of us with a model that made objects first class, and not an accident of a generalized implementation. That was Good Idea, with capital letters. It was what made the object model succeed. Now no one, other than language implementor types, and Erik Ernst, need care about activation records.
So please, lets keep that little secret to ourselves, and not let it influence the semantics, syntax or description of Grace. OK?
>
>>> the difficulty with "const" is, well
>>> readonly const x = HighlyVolatileMutableClass.new; // urgh. How is this const?
>>>
>> It's const because the binding between x and the HighlyVolatile object never changes. There is no need to ever read x more than once. You can cache it safely; if I do obj.x now and obj.x later, I can be sure that they are egal.
>
> The problem is of course saying "HighlyVolatile object never changes"
That's not what the above sentence is staying — it says that x is never re-bound.
> - the object itself changes lots;
> the point is the name always refers to the same object... yes I know you know this, but as with the
> arguments for "self" and "method" - these discussions are all about the right names
> to bias discussions in the right way...
>>
And that is the reason not to like const as a keyword, but not to reject the whole idea of fixed bindings. Did I convince you to consider set?
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailhost.cecs.pdx.edu/mailman/private/grace-core/attachments/20101116/e33d1d09/attachment-0001.html>
More information about the Grace-core
mailing list