POV-Ray : Newsgroups : povray.general : The Language of POV-Ray : Re: The Language of POV-Ray Server Time
10 Aug 2024 21:07:52 EDT (-0400)
  Re: The Language of POV-Ray  
From: Chris Huff
Date: 10 Mar 2000 16:32:51
Message: <chrishuff_99-2057BF.16343910032000@news.povray.org>
In article <38C8DD71.3560294C@neuro.informatik.uni-ulm.de>, Axel Baune 
<aba### [at] neuroinformatikuni-ulmde> wrote:

> The variant
> 
> > > #declare A = A + B;
> > > #declare A = A - B;
> 
> is far more readable than the other.

I disagree. I find this syntax:
#declare NumOfParts += PartsAdded;
#declare NumOfParts -= PartsRemoved;

much easier to read than:
#declare NumOfParts = NumOfParts + PartsAdded;
#declare NumOfParts = NumOfParts - PartsRemoved;


I read the += operator as saying "add B to A", instead of "set variable 
A to the result of adding A and B". It is a special case, and while more 
limited, makes code more readable since you know exactly what the code 
is intended to do.
Also, shorter expressions are almost always more readable than longer 
ones, even if the longer one is theoretically "cleaner".(within certain 
limits, of course. Warp's sig is not an example of shorter==better.) And 
the duplicated portion can often get quite large, even when it can't be 
put in a separate variable(I very rarely use single character names, I 
usually only use them for loop counters.).


> Besides this it would comlicate the parser of PoV if the other 
> variant should be maintained. This will lead to a new type of 
> possible parser bugs.  

As has already been said by others, this isn't true.

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

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