Extended Type Design.
jovo
jovo at at.home
Tue Mar 20 18:25:51 PDT 2007
Andrei Alexandrescu (See Website For Email) Wrote:
> You may want to modernize. "Assign" doesn't quite catch the notion of
> indirect reference, and from a couple of posts I understand that this is
> a source of confusion.
>
> 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.
> Once this is clear, the notions of values and references clarifies a lot.
>
Actually, when I use this term:
struct S {
int a;
int* b;
}
const S s;
s.a = 1; // not allowed
s.b = some_address; // not allowed
*s.b = 1; // not allowed
s = some_S; // allowed
don't look alogical, and what is more important, produces,
I think at first look, better result.
jovo
More information about the Digitalmars-d
mailing list