Re: Fwd: Re[2]: [PHP-DEV] PHP 8.1 enum const expressions problem

2021-07-30 Thread Rowan Tommins
On 30/07/2021 18:24, Kirill Nesmeyanov wrote: enum ErrorGroup: int {     case NOTICE = 0;     case WARNING = 10;     case ERROR = 20; } enum ErrorCode: int {     case UNKNOWN = 0;     case A = ErrorGroup::NOTICE + 1;     case B = ErrorGroup::NOTICE + 2;     case С = ErrorGroup::

Re[2]: Fwd: Re[2]: [PHP-DEV] PHP 8.1 enum const expressions problem

2021-07-30 Thread Kirill Nesmeyanov
>Пятница, 30 июля 2021, 16:45 +03:00 от Rowan Tommins : >  >On 30/07/2021 13:20, Kirill Nesmeyanov wrote: >> But in addition to bit-masks, there are also at least cases of addition and >> subtraction (the most popular). Can't we adapt all math expressions existing >> in nature to specific cases,

Re: Fwd: Re[2]: [PHP-DEV] PHP 8.1 enum const expressions problem

2021-07-30 Thread Rowan Tommins
On 30/07/2021 13:20, Kirill Nesmeyanov wrote: But in addition to bit-masks, there are also at least cases of addition and subtraction (the most popular). Can't we adapt all math expressions existing in nature to specific cases, thereby building our own pseudo-AST? (Some::A + Some::B) * Some:

Re[2]: Fwd: Re[2]: [PHP-DEV] PHP 8.1 enum const expressions problem

2021-07-30 Thread Kirill Nesmeyanov
>Пятница, 30 июля 2021, 13:46 +03:00 от Marc Bennewitz : >  > >On 30.07.21 02:01, Кирилл Несмеянов wrote: >> Yes, I saw this short description in your RFC ( >> https://wiki.php.net/rfc/enumerations ) about «enum sets». However, I do not >> quite understand why we can not now add a cast to scalar

Re: Fwd: Re[2]: [PHP-DEV] PHP 8.1 enum const expressions problem

2021-07-30 Thread Marc Bennewitz
On 30.07.21 02:01, Кирилл Несмеянов wrote: Yes, I saw this short description in your RFC ( https://wiki.php.net/rfc/enumerations ) about «enum sets». However, I do not quite understand why we can not now add a cast to scalars (string and int) and math expressions, which would solve this prob

Fwd: Re[2]: [PHP-DEV] PHP 8.1 enum const expressions problem

2021-07-29 Thread Кирилл Несмеянов
>> >> Hello internals! I apologize if such a discussion has already taken >> place, but I didn't find anything like it. >>   >> When working with enums, I ran into problems that are currently not >> resolved. In some cases, enumerations require self references and >> constant arithmetic expression

Re: [PHP-DEV] PHP 8.1 enum const expressions problem

2021-07-29 Thread Larry Garfield
On Thu, Jul 29, 2021, at 5:16 PM, Кирилл Несмеянов wrote: > > Hello internals! I apologize if such a discussion has already taken > place, but I didn't find anything like it. >   > When working with enums, I ran into problems that are currently not > resolved. In some cases, enumerations require

[PHP-DEV] PHP 8.1 enum const expressions problem

2021-07-29 Thread Кирилл Несмеянов
Hello internals! I apologize if such a discussion has already taken place, but I didn't find anything like it.   When working with enums, I ran into problems that are currently not resolved.  In some cases, enumerations require self references and constant arithmetic expressions:   enum Example: