Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88300 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84075 invoked from network); 18 Sep 2015 00:05:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2015 00:05:53 -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:37546] helo=mail-wi0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/92-05737-0655BF55 for ; Thu, 17 Sep 2015 20:05:53 -0400 Received: by wicfx3 with SMTP id fx3so10749827wic.0 for ; Thu, 17 Sep 2015 17:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=91ZcFx+CYOaDL4doMN/UvV8KYJ6w+3/Tyt5qxbrUfgo=; b=zNf6oeFp9ELvYL7TtszsT22JmAo7MfZl/NPugjmN3yX9iSKOvaqPJRsphUfRfXoQBM Y2/TH8NIFQvtfbuddg/RDfhokM4mmJ8Xkv2JYSizFqogO6QOdihXh+TiiVnlhfOxCEEc x7gebEvuVorQVJJL0M2RDQ+uNbX+7C7AsW5lLAgR5uTGnIbNDxtUgbIjc8UDuTtT1Lxi ynM6H0XKk98rL7DrZZYk52fu8DGGPld9TjDf1mv3xGQ9gX4fplZQ/7J5F6l2SHQ1FQdQ tqT96hoEDbcO0VjZGncEVQ7LCoZ9q32x6QncGEZDJOI9KG75+cYYadQ3DLaqtnGUXhoc 08Pw== X-Received: by 10.194.103.103 with SMTP id fv7mr3674263wjb.152.1442534749488; Thu, 17 Sep 2015 17:05:49 -0700 (PDT) Received: from [192.168.0.5] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by smtp.googlemail.com with ESMTPSA id bi6sm5886450wjc.25.2015.09.17.17.05.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2015 17:05:49 -0700 (PDT) To: user@domain.invalid, internals@lists.php.net References: <55FB4791.4040807@gmail.com> <55FB4DFC.2060204@domain.invalid> Message-ID: <55FB555C.9070701@gmail.com> Date: Fri, 18 Sep 2015 01:05:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55FB4DFC.2060204@domain.invalid> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Let's discuss enums! From: rowan.collins@gmail.com (Rowan Collins) On 18/09/2015 00:34, user@domain.invalid wrote: > Well, how are you supposed to serialize an enum value without some > sort of numerical representation or value? Maybe you could serialize > it by > converting the enum to a string representation of its name but that > wouldn't be efficient and also if a developer refactored its code base > and renamed an enum, when unserializing the data it wouldn't be > properly assigned. I don't think serializing to a name is particularly more inefficient than serializing to an integer - depending on the internal implementation, of course. Or do you mean efficiency in terms of the length of the string produced? Nor do I see it as particularly likely that somebody will rename an enum member - that would instantly break all code referring to it anyway. They could however change the order of fields without realising that it would make any difference, since most access would be of the form TypeName::ValueName. Regards, -- Rowan Collins [IMSoP]