lua-users home
lua-l archive

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


Wait. I think at first blush it may not be obvious why.

This would be useful for schemes where it is okay to assume that the only way to manipulate the length was through the object, especially through __newindex.

That may be too narrow of a use case and might encourage bad design. I could see that point of view.

I'm undecided.

-Andrew
On Sat, Jun 25, 2016 at 14:15 Andrew Starks <andrew@starksfam.org> wrote:
If you are politely suggesting that the definition of __len be extended to include an integral number value as the literal value to be used, then I concur that this would be a convenient and clear extension.

I like that.

-Andrew
On Sat, Jun 25, 2016 at 14:10 Soni L. <fakedme@gmail.com> wrote:


On 25/06/16 03:54 PM, Dirk Laurie wrote:
> 2016-06-25 20:44 GMT+02:00 Soni L. <fakedme@gmail.com>:
>
>> why doesn't __len support numbers?
> Why is a cow not a horse?
>
You can give a table to __index and __newindex. For constant-sized
types, it makes sense to use a number instead of a number-returning
function for __len.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.