|
|
Darren New <dne### [at] sanrrcom> wrote:
> It doesn't make sense for a numerical *instance* to be read-write. When you
> say a = b + c, you're not modifying b or c or the old value of a. You're
> replacing what's in 'a' with a new value.
By that definition no language ever modifies any variable.
> > I'm not understanding what you are saying.
> >
> > It sounds to me like splitting hairs with semantics. Is "a = 5" modifying
> > the value of 'a', or is it creating a "new integral value, 5, and storing
> > it over the old value of 'a'"?
> The latter.
> My point is that if you do
> a = 5; b = a; a = 7;
> you're not changing the value in b.
Of course you are. You are changing it to 5.
> If you do
> a = " hello "; b = a; a.trim();
> are you changing the value in b?
Depends on the semantics of the type.
> >> Unless your compiler is smart enough to ditch the vptr (or its equivalent)
> >> when you put the pixel into an array-of-pixels
> >
> > Why do you think I like C++?
> Really? You can have a pixel with virtual functions, and then the vptr goes
> away when you assign it into an array?
No. I can have a pixel with no vptr, and I can store such pixels in an
array. Unlike in many other languages.
--
- Warp
Post a reply to this message
|
|