▲ | BiteCode_dev 3 months ago | ||||||||||||||||
t-string are lazy, which is the point (escaping HTML, translating strings when you get preferred language headers, preparing SQL statements...). Does Ruby strings already allow lazy processing ? I'm not talking about wrapping them in a block and passing the block (all languages can do that with a lambdas) but a having literally that eventually resolves to something when you use it. | |||||||||||||||||
▲ | psychoslave 3 months ago | parent [-] | ||||||||||||||||
That's seems like the wrong pattern, maybe I'm missing something. Ruby has lazy evaluation with a generic lazy enumeration facility, whether to produce string or any kind of object. That is, I don't know what is the actual behavior of the default string interpolation in Ruby, but if profiling a codebase some string generation would gain lazy evaluation, there is a path to do so. But in the general case, does it really matter? Chances are good that a string construction is not a big bottleneck. Does Python miss such a feature of generic lazy enumeration, or is it so painful to use that some syntactic sugar felt like a must have? Genuine question here, I don't have any strong opinion on this t-string feature. | |||||||||||||||||
|