POV-Ray : Newsgroups : povray.off-topic : Another "This is why I..." : Re: Another "This is why I..." Server Time
9 Oct 2024 02:30:16 EDT (-0400)
  Re: Another "This is why I..."  
From: Warp
Date: 27 May 2009 13:31:06
Message: <4a1d78da@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.