Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116639 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 94908 invoked from network); 13 Dec 2021 10:33:58 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Dec 2021 10:33:58 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 008EC1804A8 for ; Mon, 13 Dec 2021 03:35:39 -0800 (PST) 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,FREEMAIL_FROM,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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (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 ; Mon, 13 Dec 2021 03:35:38 -0800 (PST) Received: by mail-io1-f54.google.com with SMTP id z18so18092250iof.5 for ; Mon, 13 Dec 2021 03:35:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u5uWiLJIWdAo19KHqqRnVcvLvmQGJEYk9jbqLr28yPU=; b=W92zSea09bJXxJiy1OcNBvwKUpBAprsPh32MpRdGItTo5B2kE4BGSwgjD4Jt9kn+mo p4cLujqSGJCjQbRq4XQ8dbWzj0wxBbllE9EYVzb8s4hxf8aaZSCz5VY+Q+sNmZ4t9blf fFKzBDyVbXAci5lRvbpsX5abGujTh6Mjmobi2Qs8k79CCi6BMwqa9oezmlZiIbSLaHI4 50UwhBfTOx4DpkO37Ofp6t8vPsyOzVPs4XcPxU6Kxi64P3lJqbGbMpimquF1iX/ZtDhq FRPMtci6DA/rsoxhdJUFguQbs42nR63szcVpttSE4svT4o+X9rxTqxeObplrKnvAfi2a I60g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u5uWiLJIWdAo19KHqqRnVcvLvmQGJEYk9jbqLr28yPU=; b=TgLQQabNymLT2e2tptjwKfDDN+PnC8BOldjiovzrGeHs0HXulO4EiTni1XCKpOFSZC CBJwWLGU1vjjb4GQPZexb1a2/DRHIUJ3L+eRrJLtJQFyBgzcm2ZZxmcSzm9vJYjxgbUM repXo7fkTiW3iuVhPoM8xriNoeoadtg3cLbTtNihtMVKI0aBq78aoenm7wv+nW5Hkh70 RxYwzkAhd3TgrG+lOisYxjOZdR1+lTSLt1CEjM8pPkolICXmGNsi849i2VU6rrk/LBAY hiLsEB/GztR17ewT9yUh4o634uNtPel+ER9e5Vnjj3gODcpeYudRzxjrBTvQJgL0Mree KQ/w== X-Gm-Message-State: AOAM5307h5Vt9+zC5Wmjt8D1kKrRATGBwaCq55h1Qx3rEbUupOeowX9I x9hjthGxczI1V2EG93Kz25hSObp8JM5cD3HUX7M= X-Google-Smtp-Source: ABdhPJw4MlDV3dwwnpcljNtz5jaX5sB12de158Kv+ZoKQAJ85DFleuC2Ah1gmbN75MHhz+KUp24Ij/AI05VutlkULXA= X-Received: by 2002:a05:6602:1549:: with SMTP id h9mr32161764iow.30.1639395338159; Mon, 13 Dec 2021 03:35:38 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 13 Dec 2021 12:35:23 +0100 Message-ID: To: =?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?= Cc: Lynn , PHP internals Content-Type: multipart/alternative; boundary="000000000000c708b605d30578b7" Subject: Re: [PHP-DEV] [RFC] !instanceof operator - reaction measuremen From: olivernybroe@gmail.com (Oliver Nybroe) --000000000000c708b605d30578b7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > The "instanceof" is counterintuitive for me compared to operators. Hmm interesting, might be possible to go that direction by making `T_IS_EQUAL` accept `class_name_reference`. I like that, biggest concern with this is what is the difference (if any) between ```php $object !=3D=3D MyClass $object !=3D MyClass ``` > If this isn't possible and `!instanceof` would be adopted, what about the following in addition to the proposed example? I definitely agree that those make sense, but I would say that they should prob. have their own discussion, but would be much easier to get through if this one would be accepted. > Why not "not" instead? The "!" in front of "i" in "!implements" Might be my limited knowledge on the subject, but by using `not`, we are making `not` a reserved keyword, which I think should be done really carefully. Best regards Oliver Nybroe (he/him) On Mon, 13 Dec 2021 at 12:19, Micha=C5=82 Marcin Brzuchalski < michal.brzuchalski@gmail.com> wrote: > > > pon., 13 gru 2021 o 12:10 Lynn napisa=C5=82(a): > >> Heya, >> >> While I definitely agree with this, and after more than 10 years of PHP = I >> still have the tendency to write `if ($object !instanceof MyClass)` >> anyway. >> Would it be possible, or would it collide with constants to do the >> following? >> ``` >> $object =3D=3D=3D MyClass; >> $object !=3D=3D MyClass; >> ``` >> The reason I'm hoping this would be possible, is that I often have >> brainlag >> trying to write "instanceof" and I either make several typos, or I end u= p >> with "instance" and it takes me an error message to realize I forgot the >> "of". The "instanceof" is counterintuitive for me compared to operators. >> >> If this isn't possible and `!instanceof` would be adopted, what about th= e >> following in addition to the proposed example? >> ``` >> $object implements MyInterface; >> $object !implements MyInterface; >> $object extends MyClass; >> $object !extends MyClass; >> ``` >> > > Why not "not" instead? The "!" in front of "i" in "!implements" is almost > not visible which IMO could get easily ignored unintentionally. > Instead constructs like "$foo not implements stdClass" have higher > visibility and are currently a syntax error. > > Cheers, > Micha=C5=82 Marcin Brzuchalski > --000000000000c708b605d30578b7--