Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88348 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97649 invoked from network); 18 Sep 2015 18:25:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2015 18:25:24 -0000 Authentication-Results: pb1.pair.com header.from=jgmdev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jgmdev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.174 as permitted sender) X-PHP-List-Original-Sender: jgmdev@gmail.com X-Host-Fingerprint: 209.85.160.174 mail-yk0-f174.google.com Received: from [209.85.160.174] ([209.85.160.174:35841] helo=mail-yk0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 88/27-60254-3175CF55 for ; Fri, 18 Sep 2015 14:25:24 -0400 Received: by ykdt18 with SMTP id t18so54249222ykd.3 for ; Fri, 18 Sep 2015 11:25:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=v3LWEGEeZNOdwPy730Dqtp1gylDVRuvSu/tn4G4AYP0=; b=og9Fkcv4VE5x1BJCtPzEPy9A/kxdiinHsl4YTMiG+kVweWxPDu6GEDEBjNSBfl/2IF oqJCSccrIr3ayepezZLRZbXvc67kny1UioCfEcEqykJ2WKfAG86J4pqcnYHEZWp52cgv Tc2dK6JZSKhk5rYeti3PmGh2WnSFUweUF0PxWBmEKvNXeATrz5XMcPs+s1U7H0NtbYVo 0BuwQFcPeNMGbxDR7iT1Onb8U58eKvXRY1+zJ2MfQzH/9x9QUxotmP6qog7kpORsv1c8 n1ee5CDsBOOo/sHjs0NEgtxkVKNz+Y/LN0hdT0iF4CrUN4AV++K69tIWNTzrNmZAsglh Ic9Q== X-Received: by 10.170.64.7 with SMTP id g7mr5907280ykg.80.1442600720832; Fri, 18 Sep 2015 11:25:20 -0700 (PDT) Received: from [192.168.1.121] ([24.41.170.168]) by smtp.googlemail.com with ESMTPSA id d204sm6319160ywe.56.2015.09.18.11.25.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 11:25:19 -0700 (PDT) To: Levi Morrison , Rowan Collins References: <55FB4791.4040807@gmail.com> <55FC34E6.8020009@gmail.com> <55FC476B.6020201@gmail.com> Cc: internals Message-ID: <55FC570A.7010802@gmail.com> Date: Fri, 18 Sep 2015 14:25:14 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Let's discuss enums! From: jgmdev@gmail.com (Jefferson Gonzalez) On 09/18/2015 01:21 PM, Levi Morrison wrote: > On Fri, Sep 18, 2015 at 11:18 AM, Rowan Collins wrote: >> Levi Morrison wrote on 18/09/2015 18:04: >>> >>> Anything else is trying to add value in some way – in your case you >>> are adding a primitive value that the language will automatically map >>> for you. I'm not saying that is a bad thing but I hope you can at >>> least recognize that it is an addition and not the bare minimum. The >>> RFC I am planning on proposing will have only the bare minimum because >>> it's the least controversial part and is the most useful. The other >>> stuff we can debate about later. >> >> >> That's why I was kind of surprised to see ordinal() in there in the draft - >> it's an additional field on each member, which in many cases has no >> relationship to the value being represented. > > I suspect it will be removed before hitting the official discussion phase :D > >> Also, apologies for accidentally starting the discussion of your draft "too >> early", I wasn't aware that you were working on it. I was trying to offer >> something productive to the language, since I've been spending a lot of time >> talking down new features lately. :) > > No worries – it happens. > I also believe the rfc should include type hinting of enums as has been mentioned on this discussion. That would make enumerations more useful and the rfc more complete. enum Weekday {SUNDAY=0, MONDAY=1, TUESDAY=2, WEDNESDAY=3} function set_day(Weekday $day) : Weekday { // $day can only be numbers 0,1,2,3 //$return can only also be 0,1,2,3 } Enums is a really needed feature for PHP that would have make code much more cleaner and easy to follow than what we have today.