Extended Type Design.

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Tue Mar 20 21:34:10 PDT 2007


Derek Parnell wrote:
> On Tue, 20 Mar 2007 17:24:49 -0700, Andrei Alexandrescu (See Website For
> Email) wrote:
> 
>> Derek Parnell wrote:
>>> On Tue, 20 Mar 2007 16:01:35 -0700, Walter Bright wrote:
>>>
>>>> A symbol is a name to which is 'bound' a value.
>>>  ...
>>>
>>>> Here, we bind a new value to the symbol x:
>>>>      x = 4;
>>> I used to use the verb 'to assign' for this concept. I guess that's still
>>> okay or must I modernize <G>
>> You may want to modernize. "Assign" doesn't quite catch the notion of 
>> indirect reference, 
> 
> Okay, if you say so, but I'm not having an issue with the concept of
> assigning value to something directly or indirectly.
> 
>> and from a couple of posts I understand that this is 
>> a source of confusion.
> 
> Not for me, but thanks anyway.
> 
>> A very useful way to see "int x = 4;" is that the symbol x is bound to 
>> the Platonic number 4. The 4 itself cannot change. You can rebind x by, 
>> say, writing ++x. That unbinds x from Plato 4 and binds it to Plato 5. 
> 
> Huh? Just looks like a fancy way of saying 'x' first gets assigned the
> value 4 then later, using ++x, gets assigned the value 5. By whatever, I'll
> not get hung up as I think we are on the same track here.
> 
>> Once this is clear, the notions of values and references clarifies a lot.
> 
> It does? How? If pressed, I'd say that the only difference between 'assign'
> and 'bind' is that 'assign' maybe implies an 'assignment statement' was
> used to change the value, but 'bind' doesn't care how the change is caused.

No. The difference is major. The binding to Platonic values clarifies 
that values are exactly the same thing as references to immutable 
objects. Once that is understood, it's very easy to understand all of 
D's immutability minutiae.


Andrei



More information about the Digitalmars-d mailing list