Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110903 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 86391 invoked from network); 9 Jul 2020 18:58:12 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Jul 2020 18:58:12 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 75CF8180506 for ; Thu, 9 Jul 2020 10:49: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=0.0 required=5.0 tests=BAYES_20,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: Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) (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 ; Thu, 9 Jul 2020 10:49:24 -0700 (PDT) Received: by mail-lj1-f194.google.com with SMTP id 9so3378563ljv.5 for ; Thu, 09 Jul 2020 10:49:24 -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=A94xtxvCpUVNVI7A9/Gomp4Y1sPEaujKPyMNr8ucAt4=; b=ezCNmJ7hGGHmZ6XXXHzBCVDtDk/tU2wrJ/ZJ8/ccS7cSQsT2Q5o8N6lYXdV6kE1srL jgPcSW49M7FteUyo2FH4eILqWjrzSEkkj6le6ut3+PhIMeZ+qywuvu9xQtLdGzvEVKIs 3fxL4Yuhr/+ztSu7lcSnzEwlQVMs1MZTiPDT2zGjLUwi0wzbxl6H1V5m+tE9U5Q83iof f9mSo5HAEQINXa1O96uvv8qeDcS4vRZ/dQLy2xUfHGLxM7OzgT8/RRs3rV/KMZEHGqMy 8vuhIrxTBiqzztEtRrNvbMAs03M2XSoo9ULDssrzT4Ngbx4GLIST8dBFhkyHcrsJNveQ TfUQ== 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=A94xtxvCpUVNVI7A9/Gomp4Y1sPEaujKPyMNr8ucAt4=; b=lphlW9JB7dc1oKrne2uSY+ZXiOxGlOBp0ecOWRyFofaAhoFLote3m2lxw679urlzHj SShpchhOBmZAKKMyIG53PoA9FRaJYffSD41KboD9ZDOMMTHu40iMhku+ipfxlGgeIQZy w+ltv6br4iawJTz8qXzrE38U73FlY8/7UnbH95sj/euWKCGhv3vtsFL1UvOLS83/se/x CEye9uJvyR0ulMz4gChQCQaC0IMdmrFck/Bh06J1zsaMTJClpVOTX3S6nv2VTpKN6vxw u+YnkWXeVvddiy/TtFlEfL/BwBur5o02FfU7hXlkQ98t2PcOb0Byk4cWKx75hKGjJUyC /7qQ== X-Gm-Message-State: AOAM531xb0YAK3Rz0cmf3I3lmJIvfYRavOGbvQ76Erhe8MiaqNSYSHLh usvdaVECnUSV9Se6LHfcy+Wqc7xgESZjXzpoEUE= X-Google-Smtp-Source: ABdhPJxD2j9L+5jmTAZDTf+mn/TQijgoZYl6CmYSqeP3MHNBDpT8BY/hNWYWVUFOQ7TiHNeTR3Ggqd3s0Oua5vfgcGg= X-Received: by 2002:a2e:8085:: with SMTP id i5mr32281824ljg.97.1594316963113; Thu, 09 Jul 2020 10:49:23 -0700 (PDT) MIME-Version: 1.0 References: <65EE4215-3F80-435C-B271-DBE30D26E2CB@joshbruce.dev> In-Reply-To: Date: Thu, 9 Jul 2020 14:49:11 -0300 Message-ID: To: Josh Bruce Cc: PHP Internals List 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) Hi > > Re casting - In the previous thread the following concern was presented a= nd 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 meth= ods is explained with some code examples at https://github.com/ShittySoft/s= ymfony-live-berlin-2018-doctrine-tutorial/pull/3#issuecomment-460441229=E2= =80=9D > Frankly this is something subject to personal opinions and will change over time according to community shifts. I think the main obligation of languages and runtimes is to show consistency in their design and behavior. If somehow part of the community wants to enforce that "casting is a bad practice" (because IDE support or whatever valid reason in our current decade) it's ok. But making the language behave differently for each casting scenario actually makes it harder for userland to apply the good practices of the moment consistently. > I concur with the Stringable mention - thank you for that - I have update= d based on this feedback: https://bit.ly/php-0001 > 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, ye= ah? > Yes, precisely. Thanks, M=C3=A1rcio