lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Are you an advocate only for +=. or for similar operators for all
binary operators?

As someone who's implemented and used `..=`, my 2 cents would be that adding it to the language is actually unwise.  If you're going to create a large string through repeated concatenations, you should almost certainly be using some kind of pattern that leverages table.concat().  It's far more efficient because it avoids the allocation of intermediate strings.  `..=` just creates the temptation to build long strings in a way that wastes a lot of memory and processing time. I'm still cleaning up ancient parts of my own codebase where I used `..=` when I should have used table.concat().

Arithmetic compound assignment ops are nice to have, but, the generalization to a compound assignment for all binary ops is a bad idea, imo.

-Sven