Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119775 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 64649 invoked from network); 29 Mar 2023 15:32:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Mar 2023 15:32:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8AD561804B3 for ; Wed, 29 Mar 2023 08:32:03 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 29 Mar 2023 08:32:03 -0700 (PDT) Received: by mail-wm1-f44.google.com with SMTP id s13so9179431wmr.4 for ; Wed, 29 Mar 2023 08:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680103922; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=gCNgH8u200PeFvLYGaobXuINUCuH2FgLNrffu7It7Z4=; b=fNj/E1ylC8spivGonhReusZGYhMhcqbUE92/jCwXiI3GiDFoBzMFbNWOy7EcDmBa4p CADZeBy8n3TSOiGjXpq4CJxobd3//f/HYrUTWezMC862UllVNPu4Bs11zcy2irpTuTpm et9g1lieOdBar0/C1TF963O+i7YQWxB6eE8+7yBTq2DLxk6/aITjANmzw0olhMDQGdh7 H0qQUUlLk5eRTr1c8XlYCs/Z5q7hPvpFq8vEP1y5y0pvtNEv7fGKn0gcOYPYAZLJS+9Q MsDXNYQRbxfJLIhg+PM3tTkcnb0HsfDWVEG2C5VttrGMwIvmpluzLgB6i41ziha1lMoq aW2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680103922; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gCNgH8u200PeFvLYGaobXuINUCuH2FgLNrffu7It7Z4=; b=QKzcjncnJP9sZk1krclmDcTnvFxyKZAcSxxFf4vklHJrmLReOgf0S6XIpudZcqdQ7x XTu8qUlVX5aKXRigqQiaMy0ur2FDeqWVgD002eoPABfrlUFiqfuKArnI1YqPBtVH+tZ+ qWwkLV8aSrh8jGbP8kI9HP7yoaK3WKhRfm07aJw+7rWVRk4AZYSS4dtr7lYe9XpgGfao AoHSMmkpPBJHFJ/lrJ3pD4Xc9Ky7873SqxI7j8YtLG4hxhuJHE52coYiROx3yc31mwqR VyAKSvlGVuJx/e+bgrrg/SvH6LY/slniVJrFsMhC6B6Uc8UVM1jJ31AA4l1vtO8AnO3j KJJw== X-Gm-Message-State: AAQBX9cmx8iEIu+Jbef5Bgqup3Wh4hvGkEHstWqNGehFI6NqnTVqYE5N fPoEHqzgF5kvBPcZlp4BBB4MQNpmIYB1b6nbRDv451FkUyQ= X-Google-Smtp-Source: AKy350aRCWR5WyJv1S3aVuc2S9R41O8VF097CJbOv5W1KseiJSPFt3oVD8AZEreRzkCHrh6bKg+yxo3ovE2uZ0Pq3lk= X-Received: by 2002:a7b:cd93:0:b0:3ed:f966:b278 with SMTP id y19-20020a7bcd93000000b003edf966b278mr692268wmj.0.1680103921948; Wed, 29 Mar 2023 08:32:01 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 29 Mar 2023 16:31:49 +0100 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000741b8e05f80badc6" Subject: Re: [PHP-DEV] [IDEA] allow extending enum From: rowan.collins@gmail.com (Rowan Tommins) --000000000000741b8e05f80badc6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 29 Mar 2023 at 15:26, Rokas =C5=A0leinius wrote: > Invoking it must provide a unique ErrorCode. The concept of "uniqueness" only makes sense within a certain context - the CMS easily create these two enums: enum HttpErrorCode: int extends ErrorCode { case NotFound =3D 404; } enum SQLErrorCode: int extends ErrorCode { case BadColumnRef =3D 404; } If ECS accepts both HttpErrorCode::NotFound and SQLErrorCode::BadColumnRef, and looks at the integer value, they will both be 404. Are they still "unique" in any useful way? The existing cms has > to create an enum that will be accepted as `type: ErrorCode`. > [...] > There is NO special handling for the custom ErrorCode's that the > users of ECS create. I don't understand this pair of requirements: if ECS doesn't have handling based on the value, why does it care what type it is? If it cares that it can turn it into an integer, it can just request an integer directly, or an object implementing an appropriate interface: interface ErrorValueInterface { public function getCode(): int; } From the description given, it seems like enums are sinmply the wrong tool for the job. Regards, --=20 Rowan Tommins [IMSoP] --000000000000741b8e05f80badc6--