Is this really a string concat error?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Is this really a string concat error?

Tim Mackinnon
I looked at changing the threshold of getting the string concatenation critique and got a mixed reaction, having lived with the current state a bit longer - I’m getting tired of the kind of error, but though it worth checking - do we really consider the following a warning? To me its wrong joining 2 stings with , is surely fine? In fact a stream seems overkill or surely the compiler can generate the optimal code for me? This smacks of old days where everyone was busily doing a == b just because it was supposed to be faster until the vm guys just sorted it out?

Reply | Threaded
Open this post in threaded view
|

Re: Is this really a string concat error?

Sven Van Caekenberghe-2
No, that is no error, a single #, is actually more efficient than streaming concatenation (because both the argument and result lengths are all known).

It is a pity that there are a couple of rules that are too aggressive - and I know that that was not the intention.

> On 16 Apr 2019, at 23:09, Tim Mackinnon <[hidden email]> wrote:
>
> I looked at changing the threshold of getting the string concatenation critique and got a mixed reaction, having lived with the current state a bit longer - I’m getting tired of the kind of error, but though it worth checking - do we really consider the following a warning? To me its wrong joining 2 stings with , is surely fine? In fact a stream seems overkill or surely the compiler can generate the optimal code for me? This smacks of old days where everyone was busily doing a == b just because it was supposed to be faster until the vm guys just sorted it out?
>
> <PastedGraphic-10.png>