Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116637 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91695 invoked from network); 13 Dec 2021 10:17:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Dec 2021 10:17:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1AE1218053F for ; Mon, 13 Dec 2021 03:19:17 -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=-0.2 required=5.0 tests=BAYES_20,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-ua1-f42.google.com (mail-ua1-f42.google.com [209.85.222.42]) (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:19:16 -0800 (PST) Received: by mail-ua1-f42.google.com with SMTP id p2so28471418uad.11 for ; Mon, 13 Dec 2021 03:19:16 -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=DRg52VIMI1rYFS5YjQFXd33tqucLgiVV2yeOlJa8DtI=; b=gDdWeTR2EyIZMKFhoZf65m6jv95ZjNKHSQz5Bwc9kUBysxAMXc5JwhqlYfl++qYi6I BcJowF6NSNxaLfzD14YJIfEGOq+S/1hHtW5Bf3cPwY0wQuW0kBuTU/THAbcMfp53pWbR Ra+kspLcMFY/ZZZMnk8p9K9AlAy25zLUCCWGd8MJhv31e1558Nh+hYZc1Nd2kTuAQaT5 oN2vGfOYN6Ykl9YklW14NRbxIP/WvIFk+TTtbVmMVWRDmwjPW45r/4Tt3RJlizMBvG6h hzAiv3NXxULolHnL1WJSzSy40Z0fCEFVF5A25Fp8xZ03lJUGagR+njo85PHO1xABFAjN 8OgQ== 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=DRg52VIMI1rYFS5YjQFXd33tqucLgiVV2yeOlJa8DtI=; b=TXJUnoOKtqmsDDgCq2qKvddoFOR8SMkMKiYWggpYYMpqzAFdFLFpJyeFfUo/u3Ghwc CPLOGufd1ZJCC7qL1ykvEGJvXpP3gzos12if6vJmqPtw/gdMes5eNKUScmdGIzQgfwYe EECPBoSRKQYdAeLsNWHmitBD4ZJKmQD5IWasRbiU8gDQ3S3EXfET3Vn9Dd9GBSHe4f8q Gr4Gv33LTZRFjhZbd3fuurtBoXTTQsd2SIvnX7gLd7i3t4KReOHY9JIQDiUpBzWNCsva zrheN7qS2swm8UO06GATIOFBsAiSgIdL/sMlxL+LFRgVXMkJakWNJqc/wqIXFGpMI7+3 IUEg== X-Gm-Message-State: AOAM530wf75HduX8uQqFDLNdoASywGQ5bIxDMoZniMAhf3h2wMctuHeV LuWhNT8O1ubl2Fx07C8jmtChz8ssk1GxjmC0fB4= X-Google-Smtp-Source: ABdhPJxxXaYO7wEvqLruQ5R/RdK843bcmwaAGPGdgeXsnVo7IC6TSbSQjURlfBnE2w+uOyXTXILMul+0Vrg0rjF5bvw= X-Received: by 2002:a05:6102:5093:: with SMTP id bl19mr26926767vsb.43.1639394355822; Mon, 13 Dec 2021 03:19:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 13 Dec 2021 12:19:04 +0100 Message-ID: To: Lynn Cc: Oliver Nybroe , PHP internals Content-Type: multipart/alternative; boundary="00000000000039c52805d3053e82" Subject: Re: [PHP-DEV] [RFC] !instanceof operator - reaction measuremen From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --00000000000039c52805d3053e82 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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)` anywa= y. > 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 brainl= ag > trying to write "instanceof" and I either make several typos, or I end up > 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 the > 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 --00000000000039c52805d3053e82--