Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119467 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 15169 invoked from network); 4 Feb 2023 15:23:32 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Feb 2023 15:23:32 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9E1431804F7 for ; Sat, 4 Feb 2023 07:23:31 -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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, 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-vs1-f49.google.com (mail-vs1-f49.google.com [209.85.217.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 4 Feb 2023 07:23:31 -0800 (PST) Received: by mail-vs1-f49.google.com with SMTP id h19so8348798vsv.13 for ; Sat, 04 Feb 2023 07:23:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=kOV4jrOWe/lOiJM57h4k6ApIYwDoENvvvf4N9cJxg3A=; b=lgR2UhtVc3HTKT/bEpB/F1emKDzAqPGYh/eo2Ptj2nSXh2pikDKPbjUrm9hG5gaEvd 0i8XTHxuRZTxvmqPYegX/dVHhyYygU8X/Ebfqzqr/aZB2mXXKBax8WVySSng/LZW53Lo bIjfRIX9bqY//M3y219HoYE0xuqXuO8VBspzb2Dsd/nYHCLSIVcOFz4nGgB1jUC4YcVB 7J+gl2HMwiBpWfzEdWdpMJE73sV/HmR0N3hrkWnP6W/RK2GsFZtuwgm32Fb+rztPUljJ 1PD8j17PJCxafUWJrJW9uTAJJiObxwHieQZ482WmnF/TfnsudLT1p9gaRAQP+3WVMEB/ P/8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kOV4jrOWe/lOiJM57h4k6ApIYwDoENvvvf4N9cJxg3A=; b=gZ0E59b0HxiH54zzPGf6+Qp/bic6AP7sPQ9Wc+8wf1ZPY0Qp3BlcgtjtMwlvYVvxHr wYv9wefTT11CAqgPcGQR8i932Xn6VaENRofvNwBUEc35eKLihcmlY72h9rQGUWIPAjoz eKpFSudwU5KGQDWMkJJ1sOtRmsAD+zI+nbShD0BjFpmO1MMgvv272D2ulj4pMgkP6EZV QRhlW3HBdEhnvK9hwD0DADg85lGjOrvxypbhWArw272PK/e4ZapxB/pz5nhmmgKsXGX3 9QDGPM7pdtfcc+hrzoD8TLuTrXO1Uf8UT0OPxo40v6oAlNXuVGgehmHCoiPn4PweVWe1 ORmQ== X-Gm-Message-State: AO0yUKXphHIJx0FIqjbxvc+URpcr/jZnaBZCM1V7zpMXKIVi2/to+dOb TXrcJk4Z1lccSovrcnkakBsWvIW4vX0qMo8tb6Q= X-Google-Smtp-Source: AK7set+8D/qS+rNQj9Q6Ay06oTZjslyHeK+UnpHBkNp6ho9IQ/xXsbiFUstyVT77At7q4kPG0MHl2+EwwHcwTLUn2jQ= X-Received: by 2002:a67:c897:0:b0:407:fb7:3e4e with SMTP id v23-20020a67c897000000b004070fb73e4emr451664vsk.39.1675524210443; Sat, 04 Feb 2023 07:23:30 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 4 Feb 2023 15:23:19 +0200 Message-ID: To: Deleu Cc: php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Re: Official Preprocessor From: someniatko@gmail.com (someniatko) Hi, These all are valid concerns! I cannot speak about management and cost issues though, as I am not an active PHP dev team member. > 3. What's the MVP? How do we measure usefulness, adoption and maintenance complexity? As a shot in the dark, the first step could be implementation of typed lists in my opinion. Do not implement full-blown static analyser nor the type checker for each possible case, just only check the usage of typed lists within the pre-processed files. Assume that whatever comes from the non-preprocessed ones is correct. Make only simple naive assumptions for all internal array_ functions as well as basic array operations. If there is some runtime magic going on with constructing the list, just fallback to infering the type as a simple array. For such cases, allow a special attribute which will tell the type checker this variable / property etc will indeed contain the typed list, like a @var annotation for IDEs / static analysers nowadays. The preprocessor / type checker **should not aim to 100% guarantee the correct types will be in the runtime**: TypeScript does this neither. Rowan has mentioned Dart language in a parallel thread, which makes most of the checks statically, but for some cases the compiler still adds runtime checks. Rowan warned that PHP might have a lot of such cases possible though. But I still think this also might be a good idea for MVP. > 4. Is it an aborttable idea? If things go south and can't be supported anymore, how bad for PHP adopters would it be? I don't think any of PHP new features that go live are abortable. This affects not only my suggestion, but also everything what has been done for PHP in past. Once a feature is in the language and released to the public, you cannot revert it. There must be a long multi-year process preceded with a deprecation at least. A concept of experimental features was suggested earlier, but this is completely different topic, so I believe we should not go into that rabbit hole here. Overall, I consider this question orthogonal (or irrelevant if you prefer) to the original topic, let's take as an axiom that there is no way back. > 5. How would voting on the spec be like? Complete years-work-hours spec or small incremental functionalities? Small incremental functionalities. Gradually more stuff could be proven statically, more complex cases covered, and while they are not, an attribute / static assertion could be used. Maybe some of such assertions could be allowed to be preserved in runtime, at the cost of some performance penalty, IDK. But I believe we should leave such choice to developers, whether they want the checks in runtime as well. > 6. Is versioning tightly coupled with PHP version or does it have its own version support system targeting multiple php versions at the same time? I strongly believe it must go hand in hand with the PHP version, and not as a separate tool, because I see it as a feature of a PHP language itself. > Overall, I think PHP has been constantly losing popularity in favor of Typescript and a transpiler could create an exciting solution for some of PHP's problems, but it does not seem like a pet project. Sure, it should be considered seriously and requires some upfront planning. Though, well, PHP itself started as a pet project :D