POV-Ray : Newsgroups : povray.beta-test : [doc] concat with one parameter : Re: [doc] concat with one parameter Server Time
29 Jul 2024 10:20:49 EDT (-0400)
  Re: [doc] concat with one parameter  
From: Christopher James Huff
Date: 22 May 2002 14:05:54
Message: <pan.2002.05.22.13.08.54.207328.2163@mac.com>
On Wed, 22 May 2002 07:59:33 -0500, Felix Wiemann wrote:

> Where's the problem with concat? It works fine. Aren't POVers (and
> computer users in general) known for using a function for something
> totally different than it was designed for? And I don't see any
> possibility that's as short as concat.

It's common so it must be good?
I already explained the problem with using concat(). It is intended for
concatenating strings, not cloning them. To anyone reading the code, it
looks like you made a mistake: the code does not do what it says it does.
That is a bad thing.


>> If you don't want to declare a temporary variable, a macro is a better
>                                                                   ^^^^^^
> Why?

If you really can't tell...I give up.


>> solution than misusing the concat() function. Something like:
>> 
>> #macro clonestring(String)
>>     #local tmpString = String
>>     tmpString
>> #end
> 
> Is much longer. So not better but worse.

I hope I never have to maintain anything you write...

It is longer by 5 characters, because its name says what it does. That is
a good thing. If the extra 5 characters is that bad, rename it: call it
clnstr() or something. And if you are using it multiple times, it would be
better to skip the macro completely and just use a temporary variable...in
that case, it is shorter than your misuse of the concat() function: the
usual naming convention just adds "tmp" or something similar, which is 5
characters shorter than a call to concat().


-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: <chr### [at] tagpovrayorg>
WWW: http://homepage.mac.com/chrishuff/


Post a reply to this message

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