[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Idle v1.0
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 18 Nov 2009 12:38:47 +0200
On Wed, Nov 18, 2009 at 12:21 PM, Thomas Lauer <email@example.com> wrote:
> I've tried to "orthogonalise" the available metamethods. The beauty of
> metamethods is that if you don't want or need them, they are not getting
> in the way, so I reckoned a more rounded spectrum would be helpful for
> some applications.
That seems a most desirable goal. The balance here is 'explainabilty',
e.g. does it significantly complicate any description of table lookup?
quote: "__usedindex behaves exactly like __newindex but when the
indexed key actually exists (value is overwritten). this allows simple
implementation of read-only tables, mirroring C structures etc without
slow/lengthy/fragile table proxying constructs."
So, if you want a read-only table, you make __usedindex always return nil?
This would also be very useful for implementing properties...