Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88406 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48640 invoked from network); 22 Sep 2015 14:44:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Sep 2015 14:44:05 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.50 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.213.50 mail-vk0-f50.google.com Received: from [209.85.213.50] ([209.85.213.50:32856] helo=mail-vk0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/2C-56639-43961065 for ; Tue, 22 Sep 2015 10:44:04 -0400 Received: by vkgd64 with SMTP id d64so7806729vkg.0 for ; Tue, 22 Sep 2015 07:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=b+YS4y1BgFTWW8jfke6JA7E2wjBmZkT2rCDH4cPGRTo=; b=N0y7sRVYy1Jr6lkmDJQi9IfSRh601rKUwwvcH2cXiOYxc40H1nylD4aZNlY9v6lMnW UqeUiyyq++roZb8Di3LyncG1pWzsSL2IjR1BXB3IR8V56kz6I6jTTPhe7x0Kw5pYeVB/ wWu7Yazr0LvftcqYBQBSTzB2LR4iKUDxD+Rkt2b6VLb/mPUz9pHBA/C7Bf47sEMcP9r7 tmTJ6yX+QPdS3dorvQFKnGjWc2jsSdSufWR6aiz1ZeQCvdGSIdGFz8/0Glzb4hodVSoJ xq49FRS2Y1qoJSLB5Xr/QTn3JeZX+DiE8dgfndN1Vd4uVDFQO+ElB3Z8rNek/kEBWzqD e1KA== MIME-Version: 1.0 X-Received: by 10.31.142.142 with SMTP id q136mr18130652vkd.41.1442933041228; Tue, 22 Sep 2015 07:44:01 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.31.41.205 with HTTP; Tue, 22 Sep 2015 07:44:01 -0700 (PDT) In-Reply-To: References: <55FB4791.4040807@gmail.com> <55FB4DFC.2060204@domain.invalid> <55FB555C.9070701@gmail.com> Date: Tue, 22 Sep 2015 08:44:01 -0600 X-Google-Sender-Auth: bC5q5xmSDpH6LEULymHdRzsqSlc Message-ID: To: Stig Bakken Cc: Rowan Collins , user@domain.invalid, internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: Let's discuss enums! From: levim@php.net (Levi Morrison) > The point I'm trying to make is that an enum's normalized > representation should be an integer, and that is also how it should be > serialized. It also happens to be how most other languages chose to > represent enums, and deviating from that will cause all kinds of pain > the minute you need to do type conversions between formats or > languages. You can always serialize things however you want. Using `serialize()` is just a convenience =E2=80=93 there is absolutely nothing that prevents y= ou from using a custom serialization routine. Note that while Java has built in serialization it is often not used, and instead libraries like Google's GSON are used. You register a type with hooks for serializing and deserializing, etc. It sounds like this is what you need anyway. Since built-in serialization happens differently in each language you'd probably want something custom in each language.