Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116974 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 40547 invoked from network); 2 Feb 2022 18:16:00 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Feb 2022 18:16:00 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A8B6C1804AA for ; Wed, 2 Feb 2022 11:30:32 -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-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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 ; Wed, 2 Feb 2022 11:30:32 -0800 (PST) Received: by mail-yb1-f177.google.com with SMTP id i62so1789755ybg.5 for ; Wed, 02 Feb 2022 11:30:32 -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=Ze0Ee/sD8oL5mFk4xjhtG7IQO0j2PHP/4kgf+K3JGjg=; b=fkGfLXYJkRstkNtL3SgVtTRwP65eTnwm2fEhZkPEdiZAjh4DU5lTxjz4c9qy84vY/f p14YrJ9U2tCp+zLGnIbg/mrbFL2qA4Pn4dmajElhgt6m0wzidRZD7nmPvGnafV5tlbly npcEAhk8J7rVBMKbA44NWQW/u84I+bM0howGaIP9HSScrYYgsLu58qdtvzP72avnIoqj L2el5k4cTi8c6U6vA5Ia9VSzadHacGzLD14AgJE/uSvL3fAy2Qgd7Js+JFghcpL/Yio3 s1LJ44enEhiwyRXW8y+eDjC3jW7jMfQysCvzMvyiOLV5TJxjeduFaEePuAbn9xgl46UZ RPWA== 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=Ze0Ee/sD8oL5mFk4xjhtG7IQO0j2PHP/4kgf+K3JGjg=; b=DBE42SPWpoWa7E6txyRm1hjBuRM8zmHk33gURPkN/xhzkBZMl5q3yAFwqenhZ6Pdyj bUuDJp5yjQF/ZQbtgJ0EujHedbRU/ALhkWLzYLJwVskTCDnMUJ78bynCZQctGwRwkV7y qPj2lv9h5UsasL1sXZkl4NKHaVtov2+O9LVREan5IIbLDgzlWdwqScWzmT3OWSWs5mnu EEdyQEkkgyM9UNO8VsO6Zzppky+cA3KuCRcOHhv3WEE98bY/Y4T0xmpwl/HT3MmPKArn BmqnsQ0i6xKM77dlIIeJsn/8GaWiYCuyula9AZRDqtb+G1YTOro1+5UwJl+KZekELfUj dlDg== X-Gm-Message-State: AOAM530rGEU4hEkih5KF23pQiBx0fBGlI+LvldpG4OGxWP1ZpWQFYht/ VMAVVkZpReZzSqvW7upDmvS3j2Cq5ZGz+7eyeUg= X-Google-Smtp-Source: ABdhPJxYmkjLqvspARbVSMJmwRz0/+V/zojWrK29EzMSISFv6pvP7vZpdIkzPCKiH3vy1RL6mviVZv0h7TZuQ0PHVhg= X-Received: by 2002:a81:7c2:: with SMTP id 185mr2014695ywh.114.1643830231762; Wed, 02 Feb 2022 11:30:31 -0800 (PST) MIME-Version: 1.0 References: <1c9e79d5-fd79-45a8-9c77-4228d770062d@www.fastmail.com> In-Reply-To: Date: Wed, 2 Feb 2022 11:30:20 -0800 Message-ID: To: tyson andre Cc: php internals Content-Type: multipart/alternative; boundary="0000000000000909dd05d70e0d59" Subject: Re: [PHP-DEV] Re: Adding `final class Deque` to PHP From: jordan.ledoux@gmail.com (Jordan LeDoux) --0000000000000909dd05d70e0d59 Content-Type: text/plain; charset="UTF-8" On Wed, Feb 2, 2022 at 6:59 AM tyson andre wrote: > > 4. Returning $this makes code easier to write at some cost to readability > - Developers new to php or using `Collections\Deque` for the first time > would not immediately know what the code they're reading is doing. > (less of a problem with a good IDE, typechecker, and a typed codebase, > but this isn't universal) > Having it return void, `return $deque->push()` would be less common and > this would force the meaning to be clear. > > Developers might have several guesses/assumptions based on their > experience with other methods in php/elsewhere > > - It returns the new count (JavaScript Array.push, array_push) > - It returns $this (Ruby) > - It returns a lazy copy, like you'd wanted, not modifying the original > - It's returning void and the code in question is shorthand for `return > null`. > (Python, C++ > https://www.cplusplus.com/reference/vector/vector/push_back/ , offsetSet > and spl push()/shift() methods) > > I'm not sure that I buy this as a point even. Returning an immutable Deque instance would be much more in line with modern PHP in general. A major complaint about my operator overloads RFC was how it impacted static analysis tools. I don't see how in one RFC we can say that creating work for static analysis tools is a blocking problem, and in a different RFC say that the ability to inspect the return values by the developer can't even be assumed. If we design one feature around the idea that a basic IDE may not even be used, but design a different feature around the idea that we want to minimize the impact to a third party tool that provides static analysis as part of workflow that's not even part of an IDE... well that seems like a very inconsistent approach to me. Either modern development tools are factored into the language design or they are not. This seems like a "having your cake and eating it too" situation. Jordan --0000000000000909dd05d70e0d59--