|
![](/i/fill.gif) |
Christopher James Huff wrote:
> 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.
ACK.
>>> 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...
If one knows that concat(S) creates a copy, it won't be a problem.
OK, *if*.
> 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().
Sorry, I wrote that from my current point of view. I'm writing a signature,
so the chars needed to declare the macro (or the temporary variable) are
important, too.
--
Felix Wiemann
Post a reply to this message
|
![](/i/fill.gif) |