Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122091 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95806 invoked from network); 3 Jan 2024 09:09:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jan 2024 09:09:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1704272990; bh=+QIplBfUMBA3Ylu5a9uodGpoMapgqnHw9nSpF7f3D8E=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CadFbv5uAeHSZmjvfcAaU5TJIOyVoWSor4KbM2q9EEZxnHVn8FnzLlxsX2VlXDEI3 1FztpCW9r6iz1Sl3zC2+xvtDajoHGO8HxKepuNV4QlIOZnTlHjXjKYm8uBuQABtFVX 9bp8zUx6xLrEvrTTvJnksDHz5J+oY8Mr2VZbiLIIBAjdgOxC0iDMRgbcoJSWuHM5Hx YZT2k21ASqo7fbUPaWiRegI/1vkObjtmAltpQE83V0bwUZIBVIl8yJ5HI9bMGrOY5I shERCj/JhN2Y1oDvihZlyGsIqlp29xuKAnh5B4ra1W9YYhC0izbhSUI8xp2xwt0Rm2 vQMvJrC+ST1vg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EB945180058 for ; Wed, 3 Jan 2024 01:09:49 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-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,DMARC_PASS,FREEMAIL_FROM, FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 3 Jan 2024 01:09:49 -0800 (PST) Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-50e68e93be1so9311391e87.0 for ; Wed, 03 Jan 2024 01:09:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704272957; x=1704877757; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+QIplBfUMBA3Ylu5a9uodGpoMapgqnHw9nSpF7f3D8E=; b=LK0P2qfrsIODYEp/L5O2CVjs9aByVF1kEdmlw6PBDkCCTa30j66gZxdAUZ1ZBMPzvl 2xleazV+rrM/6QX0oKcMyVO5IgM1eN5a6R2GiQ+yzPpXaSLt/rn0DTZ/1YOP7JUMNvTk Syyg2Gf+qPnCs2r9lebnA1/Uwt4NcnQwqBLhqgxoTaIK0kyJ0FLVvccXwYoK/VjKpLL2 y2XL98tsDXUfGxHNl+R7cebTXscoAuvolH9Goaotpy64Pyqgkk5i8kft24vQN1Yf1Nox rpB7eo703XzLsBP6WSyRBO4WAHUNmZWG0AD9/cnMNDD7w2a5b9vb3L3h3+r3xZ7y8ITf PkCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704272957; x=1704877757; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+QIplBfUMBA3Ylu5a9uodGpoMapgqnHw9nSpF7f3D8E=; b=a+WslYn1IKD5XZBtZUq/qpb/Q1CS4NIGgAIwylmPHUDr37Eb24sHsvEmVWzwmgFRiE 9g93mhZzQsp8fZw3UB4t/kMN1TQT7ZdcXTmoktC3Y8PqcCQ1Vt+jb0jmFb/DIxpeFhlI cz5LwuRo+oYq4CwVOz8XMzdZQsckhn6fuZjq/x69kx7uOn96UUgbHQ11owxYYk758n6I yyXXAi8K4her0f+gHQQR2Gj4xmP38oqTsoqln9njAbX3Zia60k9Ubdob0dj3PuNkCBsq usSvJRqxx8oTwjizVxBvO5tokk6VktFAzC71OxYrgJwsZUcGpWLvfWez7mNSVPQL4sxa wY4w== X-Gm-Message-State: AOJu0YxNWPptRgXDUZFOusM+EsoEhFF8lqlLtObzHuTwL0RKR97L79g+ XfDokrfDhjLTZV6ci8Zv8VBtraDWh1IKcloxOLg= X-Google-Smtp-Source: AGHT+IFkAxFKC67GAGZfm/hG58/G2MzBoBy3Ae9y520dVtl9HzN4ET1hrky+55Dv+pW2t5eV3rXwdjL1kxD8XK9HC/M= X-Received: by 2002:a05:6512:31c6:b0:50e:8eae:71af with SMTP id j6-20020a05651231c600b0050e8eae71afmr3719791lfe.32.1704272956792; Wed, 03 Jan 2024 01:09:16 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 3 Jan 2024 10:09:04 +0100 Message-ID: To: =?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?= Cc: Max Semenik , Internals Content-Type: multipart/alternative; boundary="00000000000030a5d9060e06f8d4" Subject: Re: [PHP-DEV] [RFC][Discussion] NotSerializable attribute From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --00000000000030a5d9060e06f8d4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > Hi Nicolas, > > =C5=9Br., 3 sty 2024 o 08:12 Nicolas Grekas > napisa=C5=82(a): > >> Hi Max, >> >> Hi, I'd like to propose a new attribute, #[NotSerializable]. This >> > functionality is already available for internal classes - userspace >> should >> > benefit from it, too. >> > >> > The RFC: https://wiki.php.net/rfc/not_serializable >> > Proposed implementation: https://github.com/php/php-src/pull/12788 >> > >> > Please let me know what you think. >> > >> >> Regarding the inheritance-related behavior ("The non-serializable flag i= s >> inherited by descendants"), this is very unlike any other attributes, an= d >> this actively prevents writing a child class that'd make a parent >> serializable if it wants to. >> >> To me, if this is really the behavior we want, then the attribute should >> be >> replaced by a maker interface. >> Then, a simple "instanceof NotSerializable" would be enough instead of >> adding yet another method to ReflectionClass. >> > > This should be possible without ReflectionClass, see > https://3v4l.org/N3fmO > Sure. My main point is : why use an attribute? this should be an interface to me. All semantics match an interface. > From the serialization libraries you can find similar attributes > Those a very different, because they tackle the problem from the *external* angle: the attributes there describe how a system *external* to the class itself should best serialize an object. There, attributes make sense, because they enrich the description of the class without forcibly telling what to do with the object But in the RFC, we're talking about the object deciding itself how it should be (not) serialized. This is enforced and thus belongs to the typesystem - not to an attribute. IMHO Cheers, Nicolas --00000000000030a5d9060e06f8d4--