Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115593 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 99187 invoked from network); 27 Jul 2021 14:37:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jul 2021 14:37:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BED33180505 for ; Tue, 27 Jul 2021 08:04:05 -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=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, 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-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 ; Tue, 27 Jul 2021 08:04:05 -0700 (PDT) Received: by mail-wm1-f48.google.com with SMTP id m20-20020a05600c4f54b029024e75a15716so2561998wmq.2 for ; Tue, 27 Jul 2021 08:04:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=b72KTUpfR6dDmwYyOlfmDXCaL4j3emuOX3VbIQz4ClI=; b=HpHMiAHavOwn8i0jeN0unYpYjl2gg69TpH2UhN2Jc7KaOVYgRYErohnLgCGbTUAOBB co2vSZWC8HwDgAsky+5/YOdYDAV/Cp+s6svaYxOlq3CwtQRsPNynrNQ09mgQjC/GOQWU o6aZnKERegGhwOgIrF3mvjMMxgXZIoGry4beBvYcf5pHzFc6Os7dHNVkQzK+E3AOTOWm KdJ0juqxg6D29BQXwdEHhcGZxASn51t4LusvzrXKF7y+MZHMd+I8HaoEfaetyEvR/N6W EhEQwWnj1FRkoC7djAQW5/nHCGolzrkDj/EKRxcwoYroflgUfE47arMxBPYnkY3VTroX 8J5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=b72KTUpfR6dDmwYyOlfmDXCaL4j3emuOX3VbIQz4ClI=; b=dWgkm7cJGSrD5p05aB8Gv8bLpQr0cFGnJ/K+zRIK73N1/cUe4QhEiz/9xNzqyKzs1j g+dMPDYzs5xTF2zeb4s7KbLHy79I+bClDZqOQdc9YT7H+aWl7QI1RHR3P5/bT4/apqpQ wq1MLm15V6ppi7PMrWYY0BdGrFTQFoyfhsZFIJlthfZKtbreOMybGVdJjduRYWM8hjWZ suk4UfBuV8ZTKOpy1Ps6hcT6PGI7E/K2sZAiDVUeV0LHN1QFt+TrKCaX2tCV2x074QD/ 0an8dg3IBt5dQTtJHZnXPheWEwkDRiGwqM52m60AhG7WjEomdvAtp2vpJbBmcQI02KVi s7Jw== X-Gm-Message-State: AOAM532ltLmySMhoxBduiYi0/3V59NYEu4UCJwppY1FEOl8mqIppMf+W rh9lE544h6wrthWHN2VPMKAy8yI6qHY= X-Google-Smtp-Source: ABdhPJz/vAoyGAriYzWgXYDmxbkLD109GPMkTwwWWnxnDvlbH9NHf0kbt9k2RkRqpZXZ0ts6GfKSCA== X-Received: by 2002:a05:600c:1d11:: with SMTP id l17mr13155504wms.185.1627398241101; Tue, 27 Jul 2021 08:04:01 -0700 (PDT) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id m15sm3403026wmc.20.2021.07.27.08.04.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Jul 2021 08:04:00 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <27cb08f4-d557-1f53-eadf-132eed22c08d@gmail.com> Date: Tue, 27 Jul 2021 16:03:59 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC] Nullable intersection types From: rowan.collins@gmail.com (Rowan Tommins) On 27/07/2021 14:32, Brent Roose wrote: > From a userland developer point of view: > > - PHP 7.0 types were a pain because of non-nullable types, the feature only became really useful as of PHP 7.1 You're not the only person to say this, but I find it really hard to believe. If this was so urgent that the feature was "not really useful" without it, why did it take twelve years from the addition of type declarations in PHP 5.0 (for classes and interfaces) until the "?" notation in PHP 7.1? Possibly because a syntax to make them nullable *was* added in PHP 5.1 (SomeType $foo=null), which continued to work for all the types available in PHP 7.0. Or possibly because there were enough places where people wanted non-nullable parameters that the feature was useful even if it couldn't be used everywhere. I can understand wanting to reduce the number of disruptive changes you make to the code base, but whatever version you pick, you can think of something in the next version up that you could wait for instead. Off the top of my head, you could set your minimum to... * PHP 5.1, for the "array" type declaration * PHP 5.4, for the "callable" type declaration * PHP 7.0, for "int", "string", etc * PHP 7.1, for the "?" nullable notation and "void" * PHP 7.4, for typed properties * PHP 8.0, for union types * PHP 8.1, for pure intersection types * PHP 8.2, for ... maybe mixed union-and-intersection, maybe type aliases, who knows... Maybe 7.1 was a sweet spot for you in terms of cost-benefit; maybe 8.1 won't be, but maybe it wouldn't be even with nullable intersections, and 8.2 will be. > Sidenote: weren't there any prior cases where an RFC was accepted only to have found out an oversight which resulted in that RFC to be postponed to the next release? That's the opposite of what's being requested here - what's being requested is that an extra feature be added at the last minute, without any changes to the feature already agreed. To my knowledge nobody has so far suggested that the current implementation of intersection types should be removed until this is resolved, and I can't think of any reason why that would make sense. Regards, -- Rowan Tommins [IMSoP]