Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121566 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 12325 invoked from network); 3 Nov 2023 15:13:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Nov 2023 15:13:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 74203180211 for ; Fri, 3 Nov 2023 08:13:34 -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.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-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 ; Fri, 3 Nov 2023 08:13:34 -0700 (PDT) Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-407da05f05aso15641225e9.3 for ; Fri, 03 Nov 2023 08:13:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699024412; x=1699629212; darn=lists.php.net; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=5jUMMEj4zRZcsnnqaiOfpSg8ctbW/WCj61OsxnvtGDc=; b=d4Tge0j9pgERi6RtAPazwf7h5O9AUw8X0KIxbFXtmisfJ0NV61KMQUqsXXtfWhiS5b o4k6EAOKlLZKVWZ2M3vRBuSkyhqbzlSNeg8ckdc9iJ3IjolNNARNPElH6ymmkLrsFOd1 OyP3Y7b7LsgbZVcfcB7S9jglYbLU7YEl77A89SSRdD4DwzpBc1mtYieyDjq0mSDZZ42b +05ERBXGVhTzY2UYx3JTT2t9EpnmddIzraFv97bO9YiyzpRa8Z5WU83FAaIIsOF5KLDa QlCirNlSBmqD7I+KE3sqwqDnxb+e7kk6O8Z8WzqJxxF1KLae6fh7chhcppbRY8KHXkT9 IvJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699024412; x=1699629212; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5jUMMEj4zRZcsnnqaiOfpSg8ctbW/WCj61OsxnvtGDc=; b=KIRZsIK6Y9y9M3e2XaTBso0E4EnZYTdWSKeQjltHj7bLolEFP5ypJ+dNK7n1TbB1bj ilqwEja6HmL3TXZw4q+6C6sNh3TnaZneTKwA/z/VTqoePttKojnVYxNzsTTbLSqxSCWv KyFlkLfAgLEuj09B7CPXyRj3G6OP44A6RREG5p2/d1px0/NgntJmaEoVyaxTLg7WtxOF bsMPFGVCb2jeeKjIWrJxLrg+IM2S/aJ8Xuxc1LM1x73jziRYoqzUpZcOvcO6qpdNaiGI WgwgcweltwFLNcN9mHkb5Nd7YzSRVjVNdNeAz8/VjuiJVfIHr+1gcAhOge7XKaRiXK+g Qlww== X-Gm-Message-State: AOJu0YxxXSyeweIOcOQd7CFtYjAhGXkh1ZMwrCE+Ys3X5wCvBNt/s2Se 0EqrWMUr036JAUxm6XxDBMWQMHqip6I= X-Google-Smtp-Source: AGHT+IHoyQWNYxIQNUfE9IyeklvGHOe5W2gikZL2LB7A2Hz3EyXL+MH3MJAghsZWOAoPbqqTOH7eQQ== X-Received: by 2002:a05:600c:1c90:b0:405:37bb:d942 with SMTP id k16-20020a05600c1c9000b0040537bbd942mr18326632wms.4.1699024412176; Fri, 03 Nov 2023 08:13:32 -0700 (PDT) Received: from [127.0.0.1] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.gmail.com with ESMTPSA id y8-20020a5d4708000000b0032d2f09d991sm2073429wrq.33.2023.11.03.08.13.31 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Nov 2023 08:13:31 -0700 (PDT) Date: Fri, 03 Nov 2023 15:13:27 +0000 To: internals@lists.php.net User-Agent: K-9 Mail for Android In-Reply-To: <5ea314c4-f45d-4b7c-a94d-a82931eeb80b@daniil.it> References: <5ea314c4-f45d-4b7c-a94d-a82931eeb80b@daniil.it> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Previous discussions about generics syntax only? From: rowan.collins@gmail.com (Rowan Tommins) On 3 November 2023 13:15:59 GMT, Daniil Gentili wrote: >Well, I was actually thinking of enabling these compile-time checks only = if preloading is enabled, to ensure the closed-world guarantee=2E Doesn't that just take us back to the "generic types are only optionally c= hecked" scenario you were trying to avoid? Right now, I suspect the use of preloading is actually *less* common than = the use of offline static analysers=2E Unlike OpCache itself, it's not some= thing you can just switch on for an existing code base: you've got to switc= h from rules for loading classes at runtime to generating a static preload = list in advance=2E To be reliable for static analysis, that preload list would need to be *co= mprehensive*, defining every symbol up front, then making a second pass of = cross-file analysis=2E That makes it look very much like a separate build s= tep, rather than something integrated into the normal execution pipeline=2E= I've said before that this might be the way PHP should go - a native "modu= le" concept, with full pre-compilation - but it would be quite a radical ch= ange=2E Perhaps an alternative is to change the rules of when autoloading can be i= nvoked, by allowing the preload script to recursively autoload every symbol= it can identify, rather than waiting for the relevant code to be executed= =2E I think this is how current offline static analysers work=2E That doesn't solve the "optional checks" problem, though, if preloading re= mains optional=2E We could produce an error if any generic/extended type wa= s encountered without being preloaded, but that poses a dilemma for librari= es: either don't use the new types, or impose a requirement for application= s to use preloading=2E I'm not convinced there's an easy compromise here=2E Regards, --=20 Rowan Tommins [IMSoP]