lua-users home
lua-l archive

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


On Fri, May 2, 2014 at 3:55 PM, Petite Abeille <petite.abeille@gmail.com> wrote:
> Everything old is new again:
>
> http://lua-users.org/lists/lua-l/2006-03/msg00691.html
>
> What about having the math library as the default metatable for number?
>
> Any takers?
>
>

It'd look a bit funky to call metamethods off of number literals, but
to each their own..: (2):randomseed()

I personally have always wanted the standard set of types in Lua to
have *initial* metatables (like for the table type especially), but
there's a big potential issue here -- which relates to Python.  In
Python because of how classes are organized and referenced, it's very
easy to break out of a sandbox.  So beyond hiding references to
functions that let you inspect upvalues and the stack, one should
always take care that metatables never reference other tables (it's
just too risky).

http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
-->  ().__class__.__bases__[0].__subclasses__()

(Sorry for the tangent)