[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [proposal] Type metatables per environment
- From: Patrick Donnelly <batrick@...>
- Date: Thu, 22 Dec 2011 02:56:45 -0500
On Thu, Dec 22, 2011 at 12:18 AM, David Manura <dm.lua@math2.org> wrote:
> On Wed, Dec 21, 2011 at 10:30 PM, Daurnimator <quae@daurnimator.com> wrote:
>>> Patrick Rapin <toupie300@gmail.com> writes:
>>> > My proposal is the following: provided it is possible, why not limit
>>> > the metatable scope to the environment of the current function?
>>> > Even better, I could imagine that the type metatables could be placed
>>> > in the metatable of _ENV and manipulated from there.
>>> > Type metatables are nearly unusable in a library, since the library
>>> > author cannot assume that the custom metatable won't have side effects
>>> > or conflicts in other libraries or user scripts.
>>>
>>> Soooo what are the details? How does the compiler implement this?
>>> How would it impact performance?
>
> I had similar ideas in [1] for the same reasons. It does not
> necessarily require a change to the VM but could be implemented at
> compile time or as a preprocessor (including Metalua). For example,
Problem with that is it would be completely non-viable for arithmetic
operations. It would make numeric arithmetic dead slow...
--
- Patrick Donnelly