Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:110882
Return-Path: <marcio.web2@gmail.com>
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 98159 invoked from network); 8 Jul 2020 19:03:48 -0000
Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5)
  by pb1.pair.com with SMTP; 8 Jul 2020 19:03:48 -0000
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id 0577F180510
	for <internals@lists.php.net>; Wed,  8 Jul 2020 10:54:47 -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=-0.5 required=5.0 tests=BAYES_05,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,
	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: <marcio.web2@gmail.com>
Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66])
	(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 <internals@lists.php.net>; Wed,  8 Jul 2020 10:54:46 -0700 (PDT)
Received: by mail-lf1-f66.google.com with SMTP id g139so27401958lfd.10
        for <internals@lists.php.net>; Wed, 08 Jul 2020 10:54:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :cc:content-transfer-encoding;
        bh=NrB5nVGZE/3R3OiSCl1cGw0DYguipF0/xSANyN/3TFY=;
        b=kzYVrnO6NXrMtbE5UVKePEfsSXf7x4f5eTZ+4SAC5KfLUBpAVWN4tlEWU3jYJVa1V3
         i3pSErjbxPgiZxxC0nBV1EDmz6n5UIO9j4NwgVaE0NGQnGES0Bpa0iNszg3N/rNyhZFq
         HM9FCsf4XRAjg8Yjj3UQgKyL/VDKkbEXv+Q7aVhRRDpjKYfe3cD+vBoOa4TkwmaBnamN
         sdr06CurjMbHabLpnwWJ6AY9+9kO+6TOUh5rCU7RCxBKJURqpy8QDA2T6C7cBpnmPbU0
         Qqcbhhp4DrRxXjblffYeCRi3BXQCEhsnbcpUSUBANNIGbbMN6vsaHwa8R8/GTonFhIMd
         oHyQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to:cc:content-transfer-encoding;
        bh=NrB5nVGZE/3R3OiSCl1cGw0DYguipF0/xSANyN/3TFY=;
        b=XW1vh8L9ZVw2T7FwPmobHj7ekObsZAvcG+wIPK6UfuLCpQOIqQro7gxllxr7otfrKH
         pyizCXfL0KVvbE/xB/XDdpRv7LLuj5HG/NpbG6XNrtT4g3yeNbi7929UWpsN95kVJ/hd
         4fHxyKdB+YqyUKokF9oMkv6TrwVxOrX7LNQt6xaVn3IOlFk76XAsdZPyLhd4cU+uVYbN
         /1C4hfC2mfaG26r29FhDIWo3pmTuKbFmPRrHWvbSRzkMiVU7CP+FrCjAoiYo2us3MbvM
         XweEbyArUJwyh8NCc0y0Z0BF8jD8Q0RuCHmplNU1aPUVUygxOtSTDv6H/k5AqRLcQ5cS
         HdDg==
X-Gm-Message-State: AOAM530Y5e1D0msY0+ZSx3kIOeXmrgQFww092VlObygsciIygfkns7p9
	Eu98kkOu/8QDhHlk7T+oVM+iCzeLcp+hpz1Y7wI=
X-Google-Smtp-Source: ABdhPJy6mDfjAspFoKTBY63KPCFQpWfbdS8BcKKM/oxFZZ9w8NCS4xnyVmB8WTXQtVDlHymDvu7sdJp6hX2E4hLQgq8=
X-Received: by 2002:a19:ccc5:: with SMTP id c188mr37287417lfg.163.1594230884895;
 Wed, 08 Jul 2020 10:54:44 -0700 (PDT)
MIME-Version: 1.0
References: <65EE4215-3F80-435C-B271-DBE30D26E2CB@joshbruce.dev>
In-Reply-To: <65EE4215-3F80-435C-B271-DBE30D26E2CB@joshbruce.dev>
Date: Wed, 8 Jul 2020 14:54:33 -0300
Message-ID: <CAOsHV+s3=cyv=Q38uAJ35DyP_LUjjmzTNEx3ivH_W0jR_pOzpw@mail.gmail.com>
To: Josh Bruce <josh@joshbruce.dev>
Cc: PHP Internals List <internals@lists.php.net>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Subject: Re: [PHP-DEV] [CONCEPT][DISCUSSION] Instance as boolean
From: marcio.web2@gmail.com (Marcio Almada)

Hello Josh,

> Link to working draft: https://bit.ly/php-0001 <https://bit.ly/php-0001>

From 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.

So `implements Bool` + `function __toBool() : bool` is the only path that s=
eems
entirely consistent with what we already have.

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`?

>
> ps. If you have any feedback or information on social interactions here t=
hat 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=99t end up in my=
 mouth. :)


Thanks,
M=C3=A1rcio Almada