lua-users home
lua-l archive

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

On Fri, Jul 15, 2022, 13:36 Jasper Klein <> wrote:
Op Thu, 14 Jul 2022 22:47:56 +0200 schreef Jonathan Goble <>:

> To solve the boolean issue, I would suggest adding a method to `perms`
> objects. Example:
> if perms.owner_write:in(variable_with_permissions) then
>     -- ...
> end
> ...except `in` is a reserved keyword and I don't know what would best
> replace it. (Naming things is hard!)

Something like that crossed my mind and use functions like 'test', 'set' and 'clear' instead of binary operators.
But I had hard time to make up a nice API to construct a new value from multiple flags.

You don't have to abandon binary operators. Operators and methods can coexist, each serving their own purposes. 

The advantage of functions over the binary operators is that library may gain compatibility for Lua 5.2 and 5.1

True, though I question how important that compatibility is given that both are end-of-life. Although 5.1 in particular still has some significant use in the wild.