Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101362 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62648 invoked from network); 18 Dec 2017 15:12:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Dec 2017 15:12:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=andreas@dqxtech.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=andreas@dqxtech.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain dqxtech.net from 209.85.215.53 cause and error) X-PHP-List-Original-Sender: andreas@dqxtech.net X-Host-Fingerprint: 209.85.215.53 mail-lf0-f53.google.com Received: from [209.85.215.53] ([209.85.215.53:38099] helo=mail-lf0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/C6-21958-EDAD73A5 for ; Mon, 18 Dec 2017 10:12:32 -0500 Received: by mail-lf0-f53.google.com with SMTP id w196so222085lff.5 for ; Mon, 18 Dec 2017 07:12:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=S3W78/E+6Q8E5HtYIzJYOrAf0CQ2chcgcv0PzSxqbAw=; b=krzUDv2Pxmv/Vme6WPCWtiPe9zCKCuSMbsj4wwhyq5S8PSztgzwQkNJ9t1hxlAz7DG LJ1dkmEgtCniUDgZA5EdL4k0AK/nSTP4B0+iI/FF+wq0S+OqHVcndcOQKsiY0BVPmJEm iUymS5CwJUwv0mzloxw/dNpxvMl5w67NzQHWIrcerLWfgdEHQl7CuiqRv1oO3qA8WC4a KEfvw8acI6JenJNHdmdM9CE2Jq8m1RzEACTar/Tqh0dxBsp3PjUFUG5C3Qh9/i1Ud2Pk IgNAfimVGeaxq9g4WlVYPG7BcJk5flfTjQyB4Ng4iGCZgK3/zhHj5U3eZoedbXb1SmZr o8lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=S3W78/E+6Q8E5HtYIzJYOrAf0CQ2chcgcv0PzSxqbAw=; b=sfqk3ucgsYIm6F36ighkW6Dw3YoV1f1+kw78g1uuaj2Y7evHdnwEeTV87OhHoi6wRR XnFvuFi5gK+FWiW9C2ma9lPORZF8iBY4MsnV3RvUzIXzlNiA/8pKCLjQsmLfsJNsyolp 3QI5CN6buurwJpv/WUySme2x7OwbVtG+C7BxYtcnuLYLLGgkSvAPlHuE+sk9pMFTrYzv UMKC3dGWsMskLPq+dXZm6cUSm4tGPF5rYxibATHAb6kJUjzj+HIEkThss12G6grMkqlv unGxg5me0WlsUAblHMRemM7dDHdp6g9vvTeldVsb4O2sCqRbQR6TL98Ww+z9eV3TqFhR RmfA== X-Gm-Message-State: AKGB3mIOeMt3e89EXsLtDaw/K1j8Qhpnc/INkkYTr0n2l2pv1cYP2CHK 0Z7IqN4zIeN7gUCvu7ntS7wJ8f5n X-Google-Smtp-Source: ACJfBovTVbWUYvZHZSDgA0C8ZCpari9FpksAXs+0GR8iZAJN6VKIfweXm74PoYJYN4PhNqcm25NNXg== X-Received: by 10.46.101.16 with SMTP id z16mr70971ljb.42.1513609946945; Mon, 18 Dec 2017 07:12:26 -0800 (PST) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com. [209.85.215.51]) by smtp.googlemail.com with ESMTPSA id x10sm2593918lja.55.2017.12.18.07.12.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 07:12:26 -0800 (PST) Received: by mail-lf0-f51.google.com with SMTP id r143so18123944lfe.13 for ; Mon, 18 Dec 2017 07:12:25 -0800 (PST) X-Received: by 10.25.141.74 with SMTP id p71mr66816lfd.10.1513609945485; Mon, 18 Dec 2017 07:12:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.170.16 with HTTP; Mon, 18 Dec 2017 07:12:04 -0800 (PST) In-Reply-To: References: Date: Mon, 18 Dec 2017 16:12:04 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Levi Morrison Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Covariance, again From: andreas@dqxtech.net (Andreas Hennings) Ok, I think I missed the circularity aspect in your examples. Inheritance by itself is never circular. However, return types can make this entire thing circular. So the problem would be if we try to autoload the same thing that is currently in the process of being being defined. Maybe we could generate similar circularity problems with class_exists() calls? On 18 December 2017 at 15:58, Andreas Hennings wrote: > Let me address the simple example first. > > On 18 December 2017 at 15:45, Levi Morrison wrote: >> >> I believe your algorithm fails on this simple setup: >> >> > >> interface A { >> function foo(): X; >> } >> >> interface B extends A { >> function foo(): Y; >> } >> >> interface X { >> function bar(): A; >> } >> >> interface Y extends X { >> function bar(): B; >> } >> >> ?> >> >> If I correctly typed this from memory there is no way to order this >> such that all units are defined ahead of time as needed for verifying >> correctness. This means we trigger the autoloader even though the type >> is defined in the same file. Even if we do some more complicated >> compile-time passes we'd fail on things like this: > > You need to compile all classes in the file, and then do the autoloading. > So maybe my description of the algorithm is too simple. > > However, this is not really new, and is not really a problem I would say. > What about this: https://3v4l.org/5klJQ > > class C implements I {} > > interface I {} > ?> > > Here the interface I is declared after the class C that implements the > interface. > This means the autoloading for identifiers in "extends" or > "implements" clauses already need to wait for the current file to be > fully processed. > > So yes, we need to process the entire file before autoloading anything. > But we already do that for inheritance. So it is nothing new.