lua-users home
lua-l archive

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


On 3/26/11 10:54 PM, Rebel Neurofog wrote:
My suggestion is about implementing '*=', '/=', '-=', '+=', '%=' and
'^=' operations for user data and tables only.

...

keeping module API sweet.

On the other hand, I'm strictly against using these things on
immutable data types (like 'sum += 3.5' for 'sum = sum + 3.5'):

Interesting twist. So these double operators would be reserved for overloading only, their form indicating their expressive nature?

While I don't think '+=' for addition is messy (nor Python), reserving them to be guaranteed to be overloaded could avoid confusion and still make some tricky stuff much more readable. Math, but same goes for window widgets or aggregate objects, even plain lists.

Henning