Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105599 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 59304 invoked from network); 6 May 2019 17:41:26 -0000 Received: from unknown (HELO out3-smtp.messagingengine.com) (66.111.4.27) by pb1.pair.com with SMTP; 6 May 2019 17:41:26 -0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 5EBBD24153; Mon, 6 May 2019 10:45:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 06 May 2019 10:45:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benramsey.com; h=from:message-id:content-type:mime-version:subject:date :in-reply-to:cc:to:references; s=fm1; bh=8PuwRikUlTfnL7CGunicH14 nyhUEXtspb45Q4Vx6t5g=; b=lORaCx+CLvNFxE2EyRj5PBmBgm67NHhbK2cdzea IkGCwyjzHdud+iCzwBeFp4iCeZIGbPC4t76uUV27LmT8j/SH4g2H+teO5vq7EsfS 4O1EQQn4Npzw5jDVMCmLwli0nH0LQsLzuGTr0x8SOZZJy9qJIXLbakOjHzjPX+VT CMDN53wIuN2v9uEcFgP7xdHY8BVjT7yGw1hUYU7YSNaopQQI0GaC49zKK8FA7BK8 LMegMCgXhSgdozO6K0HPVZMY2cFykF5e1BEI9PYJgy+a76BYTOF1j/Rx7bscIDMP 7bAhaYJKz50hNam0lr+7ncvFWmrT9Gq33ZC4B3fopNwcFDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=8PuwRi kUlTfnL7CGunicH14nyhUEXtspb45Q4Vx6t5g=; b=eJEOyYu27M1RS4LPsr9v6k dvgwW+wCsX/m+Osdny4lE6kLV/PXdDc15icM2bTiIeXpy19djPG7lSbsrJSt/Vc+ gKLobB878p8Xbt3pPUagouiiqqr/2Tmfug9NPb095Y1QkgOej4/hm33fziSLWlGa Ph+39203w6/sRjLtS8je/4LJLskniFVUgEs4jSqjCtluL3ADUCMzc+k/qfbefcf2 bnKQ2QPeG7C9N7P+6HKJJLwfEkK+k70V0vJzMtsBzsjaF/bGry1f/4+Qi907TTQM dIOenDAd3R1XawO0xr26qe8+GiJVidg7/BbzxFH2Q2j7Jmb3vE3dqWJ8e7pfIBoQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrjeejgdekvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffktgggufffjgfvfhfosehgtdhmre hhtdejnecuhfhrohhmpeeuvghnucftrghmshgvhicuoegsvghnsegsvghnrhgrmhhsvgih rdgtohhmqeenucfkphepleeirdeiuddrudejtddrhedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpegsvghnsegsvghnrhgrmhhsvgihrdgtohhmnecuvehluhhsthgvrhfuihiivgep td X-ME-Proxy: Received: from [10.10.42.56] (h96-61-170-50.lvrgtn.dsl.dynamic.tds.net [96.61.170.50]) by mail.messagingengine.com (Postfix) with ESMTPA id 37EA0103D4; Mon, 6 May 2019 10:45:05 -0400 (EDT) Message-ID: <85704607-34F6-4916-9DEF-8B44EA8F6F97@benramsey.com> Content-Type: multipart/signed; boundary="Apple-Mail=_3EC317E2-00F0-4609-818D-345BB8B35C57"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Date: Mon, 6 May 2019 09:45:04 -0500 In-Reply-To: <27CB5952-9688-44BF-B401-F3E04DE00710@gmail.com> Cc: internals@lists.php.net To: Steven Wade References: <384B1934-FC7A-414D-BC31-E5521B2F0E17@benramsey.com> <27CB5952-9688-44BF-B401-F3E04DE00710@gmail.com> X-Mailer: Apple Mail (2.3445.104.8) Subject: Re: [PHP-DEV] Proposal for a RFC From: ben@benramsey.com (Ben Ramsey) --Apple-Mail=_3EC317E2-00F0-4609-818D-345BB8B35C57 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 6, 2019, at 09:37, Steven Wade wrote: >=20 > That being said, adding an interface like `ArraySerializable` might be = nice too. I'm seeing technical arguments against adding magic casts, but = (just spit-balling here), what if a class implemented a new = `ArraySerializable` interace with whatever method it demands, and if = that is attempted to be cast to an array either manually by calling = "(array) $foo" or PHP attempting to, then the array serialize method is = called. =C2=AF\_(=E3=83=84)_/=C2=AF That=E2=80=99s how I would prefer to see it work. BTW, I=E2=80=99m not suggesting `ArraySerializable` as the name. I used = that to make a connection to `JsonSerializable`, which I think did a = good job of using an interface for this kind of thing (even though = it=E2=80=99s not quite the same because there=E2=80=99s no cast for a = JSON type). In some of my open source projects, I=E2=80=99ve had to add = `__toString()` to the interfaces to ensure that implementers implement = it. It would be nice for my interfaces to instead extend an internal = interface like `Stringable`. -Ben --Apple-Mail=_3EC317E2-00F0-4609-818D-345BB8B35C57 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iHUEAREIAB0WIQToXQMR3fpbrPOmEOewLZeYnIwHGwUCXNBIcAAKCRCwLZeYnIwH G5x5AP9MTnNgF2DIiut2nH7CSa6X+JYkPu1voYXithktYm+pPQD/dO24/7jktjIC X1/yO1sZkHgpPe75/kLdI8y5i3mjIvc= =15dx -----END PGP SIGNATURE----- --Apple-Mail=_3EC317E2-00F0-4609-818D-345BB8B35C57--