lua-users home
lua-l archive

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

Not everything that uses << or >> is performing something analogous to
a symmetric bit shift.

C++ developers, for example, use it to mean insertion and extraction.

I don't know off the top of my head if there are any popular Lua
libraries that use the operators for asymmetric behaviors, but it
wouldn't surprise me if LPeg were among them. (I haven't actually used

When implementing Set functionality you can reuse operators nicely

[1,2,3,4] | [5,6,2,3]  = [1,2,3,4,5,6]   (union)
[1,2,3,4] & [5,6,2,3]  = [2,3]           (intersection)

If you take the metamethods out of math context it's really nice that all
of them are available.