Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88314 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24179 invoked from network); 18 Sep 2015 08:43:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2015 08:43:09 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.175 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.175 mail-wi0-f175.google.com Received: from [209.85.212.175] ([209.85.212.175:36843] helo=mail-wi0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/06-19961-B9ECBF55 for ; Fri, 18 Sep 2015 04:43:08 -0400 Received: by wicgb1 with SMTP id gb1so22507252wic.1 for ; Fri, 18 Sep 2015 01:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version:content-type :content-transfer-encoding:subject:from:date:to:cc:message-id; bh=W0aRq+kwrQC4nsLHRPBTHwMCO1Un8yrIBcYTbdmU0mY=; b=Yt9I2xBzmD1YIMOHeEIfJ8Wc00dyzM9+gotYQtIFDdQS6qurwy6ZmBItOewJmc6HQy MBDnsNloPpRzJjkxYALOgVOxlqZBdim8tnBB9TZ6mwddoVlhkarEd/xxqyi2HD0J+d3e YxiWZMWBqEFCtJN2GesWWXBYgrx1gQFzwq2U9QeD/hGYKLYqLyvmiPx7AemjGBVqy8sT uw8y0LfYgd5ZLPm0veFTZkazE/VDjH+ZswmruuwADbwZIh8VDV7QotMol5MHDxy0MNFX aUYE7CgkKgLrfWOPX2X3hwgnC9RnnypjYVkoqeEmn9mcEozGwpfr5GbKrUOoO9ivnSAQ uFGw== X-Received: by 10.194.22.97 with SMTP id c1mr5713001wjf.72.1442565784773; Fri, 18 Sep 2015 01:43:04 -0700 (PDT) Received: from [192.168.0.6] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by smtp.gmail.com with ESMTPSA id x7sm14324103wia.5.2015.09.18.01.43.03 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Sep 2015 01:43:04 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: References: <55FB4791.4040807@gmail.com> <55FB533F.7080301@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----SBI0JQ3K0PQLDTFTZSRH775F7GCEST" Content-Transfer-Encoding: 8bit Date: Fri, 18 Sep 2015 09:42:57 +0100 To: Bob Weinand CC: PHP internals Message-ID: <7726D162-4710-44BE-A1D0-44C2715D4160@gmail.com> Subject: Re: [PHP-DEV] Let's discuss enums! From: rowan.collins@gmail.com (Rowan Collins) ------SBI0JQ3K0PQLDTFTZSRH775F7GCEST Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 On 18 September 2015 01:15:43 BST, Bob Weinand wrote: >The reason it is not an associative array is that the names are not >important. ... >You never should *rely* on the ordinal value of the enum for anything. I feel like I'm missing something here. In my mind, the only absolute universal about all enum implementations is that you refer to values by constant names - e.g. Weekdays::SUNDAY. The name 'SUNDAY' is as fundamental and unchanging as the name 'Weekdays'. We rely on names to reference classes and functions all the time, and to serialize properties of an object; so what is it about enums that makes having an integer accessible so important? I note that Java does supply an ordinal(), but the docs say you should basically never use it. Regards, -- Rowan Collins [IMSoP] ------SBI0JQ3K0PQLDTFTZSRH775F7GCEST--