Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117516 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 2277 invoked from network); 11 Apr 2022 14:46:53 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Apr 2022 14:46:53 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EFA4318037E for ; Mon, 11 Apr 2022 09:18:24 -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.7 required=5.0 tests=BAYES_05, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE 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-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (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, 11 Apr 2022 09:18:24 -0700 (PDT) Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-d6ca46da48so17734606fac.12 for ; Mon, 11 Apr 2022 09:18:24 -0700 (PDT) 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=trsvrhSvU6n9KuwGBgDHnfIWgpVU6uxFlp9E2Pl4CBQ=; b=qzKeIfEz4O2t/M7p7F6H9VxsLrnfqLHB0obvIwOWnjKs2lxfFPRm6uUpTGQSfY5obH Jus5sz/wXqnxXACOmJYrsyUlhMlI0ycw3sAEGEvfv0UNgYbEAEXhudjOs7UOMpM5vKLX ypYOr6UO4frcNEkyz6/M1eHhtrbORYghVq/8g7/77GMxFrOGKuA5VBZbco+bemxb7pJh 80gfocmCa+xXmxCNjtzU2AV5bleZx4EzKS/AoSmWjd4SWlyM2I0CqWe/kLkWSP2sOP4f XIRTQrWU+b4A3YdJyMoienLVIhxDhuTOkoA3eAorJMjGt7Pl4m+xH2o03Y0PbRCikPAX npog== X-Gm-Message-State: AOAM532C2mpXN5u/J8KTf77TNkAkOsvayZgg2P/bR+gxhYx06Byj0agg BVDDcpxXyN2uIYtEq9SbWchY49xoWcTdz5i+yA0Xhw== X-Google-Smtp-Source: ABdhPJzQjhTTlGwynzDrwTw+mIbX2ePCoMm8tH/9/2Zk6CNQGS//BV+64zZUsRaHCm6VzI2ijxVLVqzKa3j+gsyrIa0= X-Received: by 2002:a05:6870:9589:b0:dc:4640:ef89 with SMTP id k9-20020a056870958900b000dc4640ef89mr14597331oao.175.1649693903975; Mon, 11 Apr 2022 09:18:23 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 11 Apr 2022 11:18:13 -0500 Message-ID: To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: "G. P. B." , PHP internals Content-Type: multipart/alternative; boundary="000000000000228cc605dc634b79" Subject: Re: [PHP-DEV] [RFC] Add true as type From: pollita@php.net (Sara Golemon) --000000000000228cc605dc634b79 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 11, 2022 at 8:59 AM Tim D=C3=BCsterhus wrote= : > For `true` the story is different, as this type is an entirely new type > available to userland and by the same argument one could have literal > strings or literal integers as distinct types as well. I wouldn't object > to that per se (and there's precedent in TypeScript), but there could be > a clearer plan for the type system as a whole, instead of adding types > piecemeal. > ^This. The bit about making a plan, I mean. A slow erosion of what it means to be a type might be the easier pill to swallow, but it results in more chaos overall in the type system. I'd like to see someone (literally anyone) take the time to sketch out a more complete picture for the type system. We can implement it in pieces and parts, but we should have a goal in mind for where we want to land. Using this RFC as an example, it naturally leads into the question of value types (which is what `true` really is, a bool with a value of true), so why can't we say this method must return the number 42 or a string containing 'pamplemousse' ? A roadmap would help us understand what those kinds of value types (in an unbounded type like string or a large bounded type like int) compared to the tight bounded type of bool. And yes. Generics. We can't talk about the type system without the subject of generics being extremely relevant. Ignoring them because it's complicated is just kicking the can down the road. All that having been said, sure. I don't mind adding true for completeness, because it's fairly obvious and the scope of bool is fairly small, but I would really encourage anyone to step up and plan out a wider reaching goal for the type system. -Sara --000000000000228cc605dc634b79--