lua-users home
lua-l archive

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


2010/1/14 Ignacio Burgueño <ignaciob@inconcertcc.com>:
> But I can't think of a case where the length of something is not a numeric
> value.
>
> For me, __len has clear semantics. The length of something is measurable in
> 'n' units, with 'n' being a number.
>
> Using __len for other uses seems like a case of operator overloading abuse
> (C++).

I can think of a pretty high-profile example of this - Roberto's LPEG
library overloads the # operator for LPEG pattern objects for
something entirely unrelated to length (it "returns" a new pattern).

-Duncan