Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112429 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 2473 invoked from network); 5 Dec 2020 16:18:45 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Dec 2020 16:18:45 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 298FC180511 for ; Sat, 5 Dec 2020 07:47:13 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 5 Dec 2020 07:47:12 -0800 (PST) Received: by mail-wr1-f54.google.com with SMTP id r3so8269609wrt.2 for ; Sat, 05 Dec 2020 07:47:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=THf8VFQns1jVbZL5GHz213DWHtJGwUNTf9hbgEptWn0=; b=SuoZfhfe7AjOEsJi9JctpK9+EoANhxkCvCL8X5xZU/K97egZ6+ITNSypzOYB5wUibu 8uby4Y2OLbL44GcPsWx5UOuRQHEQgzczfiBZ4yTs9H4PNhQ29u851PmAfzVKdACCLWPt Vs69RePyHu+PUxudgG6HtnomC6zb1+8dfBj/6+pmZmXKnYFHyqlQpcHvi2Hjki3oBH8Y 9R6fvYjLKQw3COpdq19oSGJ0zMAFRhscTiWQp+kul4g3knWkZ5ak5uiLDP1e1OAFq51F ZNToPP6LC9vr2AjTDd6NTvRrjh7kfH6Ea4LusdovGoopVTatjWY/d6cJJmhvU7dcogev RxIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=THf8VFQns1jVbZL5GHz213DWHtJGwUNTf9hbgEptWn0=; b=RkGLiVMXxqg7O22HhDUgIgcjNqGY81xSGcFN7qyZypBca+McumRriKc3zW3vz/AbEE wR+V/dTLbT0MrO4YzwEL9XvuNc4/qTa5RSDhefP5r+3hEKZKTE9zYFdH/4JuSJUYXGvq 2qHG3xeZMWMqPa5bwaKWmTx95sbT6i75U9LWnhxXSjsH5fthaF/yQqm98yCHS/u9Tty0 vC0FNxRYQqHxCXnZF81y/BwgGE08R/ELz3WVuta0ColL7iXDgM0VHQ8fobJiKDlkxCPk Dc3rO10Twj92F6N9F4dBU+JGjRCH8j9jgUWRjeFgcZvsO0vLUPEDAhragVv8LFH7cEmy uUlw== X-Gm-Message-State: AOAM530luT4ZpkUrolYB9wAtMq8/4VEwQMPJTqpOSFkmLQvUPfCJ7LZE bBhVJrQ6Ztd0qvrxoRolJgU5FQu0ss4= X-Google-Smtp-Source: ABdhPJxGczOytjyZ/w+oY/2kngw4uPqU78iLnHV0u6U1D1wPrKul0xhMK2eeIkxUFp++W31+uDlFrQ== X-Received: by 2002:adf:ec0c:: with SMTP id x12mr10992178wrn.307.1607183230198; Sat, 05 Dec 2020 07:47:10 -0800 (PST) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id d15sm8537433wrx.93.2020.12.05.07.47.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 05 Dec 2020 07:47:09 -0800 (PST) To: internals@lists.php.net References: Message-ID: Date: Sat, 5 Dec 2020 15:47:07 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC] Enumerations From: rowan.collins@gmail.com (Rowan Tommins) On 05/12/2020 15:08, Larry Garfield wrote: >> * Are cases serializable? >> `Suit::Spades === unserialize(serialize(Suit::Spades)) // true` > Right now they'd do the same as objects, so they'd serialize as an object. Unserializing like that, though... hm, that would probably NOT still be === due to the way PHP handles objects. That's probably undesireable, but I'm not sure at the moment the best way around that. I'll have to discuss with Iliya. > I guess what it comes down to is whether / how easily a class can return an existing instance when asked to unserialize, rather than setting properties on an existing instance. That is, given the string "C:4:Suit:6:{Spades}" can the class definition return the appropriate singleton for Suits::Spades rather than a newly constructed object? If this proves tricky to implement, it would probably be better to forbid serialization than using the default object format and breaking the singleton-ness of the case objects. Regards, -- Rowan Tommins (né Collins) [IMSoP]