Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110893 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82635 invoked from network); 9 Jul 2020 13:22:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Jul 2020 13:22:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8B143180509 for ; Thu, 9 Jul 2020 05:13:25 -0700 (PDT) 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,HTML_MESSAGE,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 crocodile.birch.relay.mailchannels.net (crocodile.birch.relay.mailchannels.net [23.83.209.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 9 Jul 2020 05:13:24 -0700 (PDT) X-Sender-Id: dreamhost|x-authsender|josh@joshbruce.dev Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id B1CBB101934; Thu, 9 Jul 2020 12:13:22 +0000 (UTC) Received: from pdx1-sub0-mail-a71.g.dreamhost.com (100-96-23-19.trex.outbound.svc.cluster.local [100.96.23.19]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 07E7B10198E; Thu, 9 Jul 2020 12:13:18 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|josh@joshbruce.dev Received: from pdx1-sub0-mail-a71.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.8); Thu, 09 Jul 2020 12:13:22 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|josh@joshbruce.dev X-MailChannels-Auth-Id: dreamhost X-Reign-Tart: 28216a5b6df4b6d0_1594296802445_332424429 X-MC-Loop-Signature: 1594296802445:693226883 X-MC-Ingress-Time: 1594296802444 Received: from pdx1-sub0-mail-a71.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a71.g.dreamhost.com (Postfix) with ESMTP id B5F9A804D7; Thu, 9 Jul 2020 05:13:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=joshbruce.dev; h=from :message-id:content-type:mime-version:subject:date:in-reply-to :cc:to:references; s=joshbruce.dev; bh=id1DHMXARcHdCDFsblU0dZWtH 8w=; b=AGbkVsX0SD3dZPo8EErbJ1h299LVWdWvTx3s0KER8Vux466hAzC+8jGdC 4O0yOToeWWpuCwseI4o5mIuffjSEVc+t0Cx+kup9KAiL3jhGZNEiQdi3OP3+GsRU YxEYHYWv4Iy9L/nXB7hjWA0C/HdOOMcNvMfk+A/peNNlgzsl/c= Received: from joshs-mbp.lan (21.140.29.136.in-addr.arpa [136.29.140.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: josh@joshbruce.dev) by pdx1-sub0-mail-a71.g.dreamhost.com (Postfix) with ESMTPSA id 0D9AD804DA; Thu, 9 Jul 2020 05:13:16 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a71 Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_8E170A53-AF53-467F-AEC1-B2268369BBDA" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Date: Thu, 9 Jul 2020 07:13:15 -0500 In-Reply-To: Cc: PHP Internals List To: Marcio Almada References: <65EE4215-3F80-435C-B271-DBE30D26E2CB@joshbruce.dev> X-Mailer: Apple Mail (2.3608.80.23.2.2) X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -51 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedrudelgdehtdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenogfuuhhsphgvtghtffhomhgrihhnucdlgeelmdenucfjughrpefhkfgtggfuffgjvfhfofesrgdtmherhhdtjeenucfhrhhomheplfhoshhhuceurhhutggvuceojhhoshhhsehjohhshhgsrhhutggvrdguvghvqeenucggtffrrghtthgvrhhnpeekgeegteejgeefueetteeufefhieejvdetueelteeigfdvgfeuudehtedvgfegtdenucffohhmrghinhepsghithdrlhihpdhgihhthhhusgdrtghomhenucfkphepudefiedrvdelrddugedtrddvudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehjohhshhhsqdhmsghprdhlrghnpdhinhgvthepudefiedrvdelrddugedtrddvuddprhgvthhurhhnqdhprghthheplfhoshhhuceurhhutggvuceojhhoshhhsehjohhshhgsrhhutggvrdguvghvqedpmhgrihhlfhhrohhmpehjohhshhesjhhoshhhsghruhgtvgdruggvvhdpnhhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth Subject: Re: [PHP-DEV] [CONCEPT][DISCUSSION] Instance as boolean From: josh@joshbruce.dev (Josh Bruce) --Apple-Mail=_8E170A53-AF53-467F-AEC1-B2268369BBDA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 8, 2020, at 12:54 PM, Marcio Almada = wrote: >=20 > Hello Josh, >=20 >> Link to working draft: https://bit.ly/php-0001 = >=20 > =46rom a type safety POV I'd prefer to have an interface available, = the > same way we did > to the Stringable interface RFC. But I'd rather keep these engine > affecting behaviors > with the same magic method naming conventions and its `__` prefix. >=20 > So `implements Bool` + `function __toBool() : bool` is the only path = that seems > entirely consistent with what we already have. >=20 > The draft doesn't mention (bool) casting behavior at the time I'm > reading it, but you do > mention the possibility. It seems necessary to me. Why wouldn't > `(bool) $my_bool_obj` > behave differently from `(string) $my_stringable_obj`? >=20 >>=20 >> ps. If you have any feedback or information on social interactions = here that might help, please do let me know, normally I would have = watched for a while before putting my foot in - hopefully it doesn=E2=80=99= t end up in my mouth. :) >=20 >=20 > Thanks, > M=C3=A1rcio Almada >=20 Hello Marcio, Thank you for the input. Re casting - In the previous thread the following concern was presented = and I don=E2=80=99t know enough about that area to respond effectively: = "I'd endorse avoiding object-to- casts via cast operations: they = are a good source of bugs. My rationale for the discouragement of magic = cast methods is explained with some code examples at = https://github.com/ShittySoft/symfony-live-berlin-2018-doctrine-tutorial/p= ull/3#issuecomment-460441229 = =E2=80=9D I concur with the Stringable mention - thank you for that - I have = updated based on this feedback: https://bit.ly/php-0001 = =20 I=E2=80=99ve also included a =E2=80=9Cquestions outstanding=E2=80=9D = section as I could imagine people losing threads and wanted to give a = way to =E2=80=9Cget up to speed=E2=80=9D quickly. Given that the goal would be to have the class be used in place of a = bool everywhere, I would think we would need to make it cast-able to a = bool, yeah? Cheers, Josh ps. Thank you again. I feel like every bit of feedback causes a re-write = and iteration on the presentation. Lol --Apple-Mail=_8E170A53-AF53-467F-AEC1-B2268369BBDA--