Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112663 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 50619 invoked from network); 30 Dec 2020 16:05:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Dec 2020 16:05:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B67831804D4 for ; Wed, 30 Dec 2020 07:40:07 -0800 (PST) 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.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from vie01a-dmta-pe05-3.mx.upcmail.net (vie01a-dmta-pe05-3.mx.upcmail.net [84.116.36.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 30 Dec 2020 07:40:06 -0800 (PST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1kuda1-0002Co-3j for internals@lists.php.net; Wed, 30 Dec 2020 16:40:05 +0100 Received: from mail02.home ([213.47.1.177]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id udZ2k1JO2O4rAudZ3kuMJ8; Wed, 30 Dec 2020 16:39:05 +0100 X-Env-Mailfrom: markus@fischer.name X-Env-Rcptto: internals@lists.php.net X-SourceIP: 213.47.1.177 X-CNFS-Analysis: v=2.3 cv=RNDN4Lq+ c=1 sm=1 tr=0 a=/qIKuKYhvfCm6iufBMIR7Q==:117 a=/qIKuKYhvfCm6iufBMIR7Q==:17 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=zTNgK-yGK50A:10 a=2EALvoLjsrEA:10 a=ZZnuYtJkoWoA:10 a=44SnJIqTN3kzGCsCcuAA:9 a=QEXdDO2ut3YA:10 Received: from mail02.home ([192.168.1.14] helo=[IPv6:::1]) by mail02.home with esmtp (Exim 4.72) (envelope-from ) id 1kudZ1-0005GU-UU for internals@lists.php.net; Wed, 30 Dec 2020 16:39:04 +0100 To: internals@lists.php.net References: <856d4f8d-e901-ba76-e421-303b7a7bc05e@fischer.name> <60068AD9-FF8A-40F5-B3FD-4E97BEBA9CD6@gmail.com> Message-ID: Date: Wed, 30 Dec 2020 16:39:03 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <60068AD9-FF8A-40F5-B3FD-4E97BEBA9CD6@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam_score: -6.3 X-Spam_score_int: -62 X-Spam_bar: ------ X-Spam_report: Spam detection software, running on the system "scanner01.home", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On 30.12.20 12:00, Rowan Tommins wrote: > On 30 December 2020 08:43:33 GMT+00:00, Markus Fischer wrote: >> What is the scalar value for a ScalarEnum if none is explicitly >> defined? > > The question has no answer, because the declaration of the enum itself would be invalid: > >> If an enumeration is marked as having a scalar equivalent, then all cases must have a unique scalar equivalent defined explicitly. > > enum Suit: string { > case Hearts; > case Diamonds; > } > > Presumably, this would result in an Error being thrown when compiling the declaration. [...] Content analysis details: (-6.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: fischer.name] -3.4 NICE_REPLY_A Looks like a legit reply (A) X-CMAE-Envelope: MS4wfMInsdg/CeCHgGX3n6cI+ffgDxYhA/c3Xw2azlOUpXaEHR8/vJcbBeX6PqDhcOqUeSitkrSMzhb0/PfPcrC1T8lE3i/SBJxTRbiLNqqElWEbMY/Y6FRK uCBa3RpXUt7lKd5tfUho6xYKun+UpOdNnht4OqPuWLOs4sVgfco11a2o Subject: Re: [PHP-DEV] [RFC] Enumerations, Round 2 From: markus@fischer.name (Markus Fischer) On 30.12.20 12:00, Rowan Tommins wrote: > On 30 December 2020 08:43:33 GMT+00:00, Markus Fischer wrote: >> What is the scalar value for a ScalarEnum if none is explicitly >> defined? > > The question has no answer, because the declaration of the enum itself would be invalid: > >> If an enumeration is marked as having a scalar equivalent, then all cases must have a unique scalar equivalent defined explicitly. > > enum Suit: string { > case Hearts; > case Diamonds; > } > > Presumably, this would result in an Error being thrown when compiling the declaration. I see. What's the quickest way (=less code) to have an enum represent it's lexical name as the literal values? So that `… case Foo; case Bar; …` results in `::Foo->value === 'Foo'` etc.? Is this possible without implementing this manually for all cases? thanks, - Markus