Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103740 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76073 invoked from network); 15 Jan 2019 14:13:13 -0000 Received: from unknown (HELO mail-ot1-f48.google.com) (209.85.210.48) by pb1.pair.com with SMTP; 15 Jan 2019 14:13:13 -0000 Received: by mail-ot1-f48.google.com with SMTP id i20so2100394otl.0 for ; Tue, 15 Jan 2019 02:49:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FX+EMD8vKITJ2ukS5apUQU9BCY968U2wpUDR8mU7qNk=; b=DE6wTgM4KnrNX20i4OeYzEfWqFWb0dYZ93iA/SC7z9sD9YhEzWIFttvjFDcCUM4JR8 YN468E0FOLldZnjpGsQdVqOW84R4qslt0zuDG639zEd4yyEq85hwu6D513ClVdj+CLjQ OCJhJpVSOmUyEa/YTXqdyzeTA2tmULnyfCeoWfx3LQFRMCQv+QuKKBJ1F1Yg1fyvDW6J kqE4KxklbqRXUfpheCYk22wd4OxO5KxVu7MClVKgj3qK+dIVGx8F+X5G6T48iaosTD8e 9qvtuhQmZHLr+AOK+bXs6msyG/GbKR9sty8fETmdDxuZ/hF+WyFqdR4TM/c5Vay325XU iKjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FX+EMD8vKITJ2ukS5apUQU9BCY968U2wpUDR8mU7qNk=; b=h7zIuZh+pd4XyTj59eq16sJgX4j4aVaFMjHR0GIRi6OZlOlleTViiFxxwZqhtDgHdG dphjToryIx0yEtZGw8823Jzs2PZJ+ysyWchrGAmKQWTLk/GKouej22LSCh5ceb0osNwA ujdbiaVbZDNQp0Nakti3w6zCzCSuyO30ABi944tkGzETFpryBr5WsJ7GyoRJdmboZOfG Z6BO1xI+mM72JYmDLlN7BMy6mli47Jxzah3zJxi9Nks0/DroSdRHMSHis+ztfVXlWU8i rItrID9heIcscLY6D/RjVb3lM6SeM0RhfzsgpbW+wu2H/cWjZIpIMdT75XlzMS69eQdE MhWg== X-Gm-Message-State: AJcUuke1SK0RKrAom+CW7vQUmPrxfI3p1w4yTgeSGQqD2MVntpLdePf9 gVOis54zYDHbPTHbf/SgZdwrz2ZM6wSLdXaY5QM= X-Google-Smtp-Source: ALg8bN7CsjH3kFk7/qzVzOjPacds58naMwBDOV2MzFqymg+N/hKywQ7aPZ0/smg923ZXzwh68+JM2jKS0Y3DLatDdjc= X-Received: by 2002:a05:6830:2010:: with SMTP id e16mr1879421otp.86.1547549344082; Tue, 15 Jan 2019 02:49:04 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 15 Jan 2019 11:48:51 +0100 Message-ID: To: Marco Pivetta , Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000ed2eea057f7ce8a1" Subject: Re: [PHP-DEV] [RFC] Reflection for references From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000ed2eea057f7ce8a1 Content-Type: text/plain; charset="UTF-8" Thank you Nikita, I will definitely need that RFC! Answering to Marco: * `ReflectionReference` seems to be designed around arrays only: maybe > `ReflectionArrayKeyReference` or such? > I agree with the wording in the RFC: the array is the primitive data structure in PHP that holds references. ALL other data structures can be turned to arrays. That includes objects with `(array)` and scopes with `get_defined_vars()`. Adding eg support for objects directly would open several questions, like: what about magic methods?, etc. So to me, we really need the simplest yet most powerful primite, and here it is, anything else can be built on top. > * Can the `getId()` return type be restricted to either `int` or `string`? > A string would be enough I suppose, but I'll let Nikita anwer :) > * what are possible scenarios for getting the identifier as a primitive, > Indexing. Eg VarCloner needs an index of already discovered references to do its job. > * There seems to be a lot of design around `ReflectionReference#getId()` > to avoid leaking internal pointer information: can it be completely > dropped, if we have `$ref1->matches($ref2)` instead? > Nope, see previous answer. As such, I think `matches()` would be added complexity for core with no extra benefit/power for users. In short, I really like the RFC as is :) (I removed your other comments Marco because I don't have anything special to say on them) Cheers, Nicolas --000000000000ed2eea057f7ce8a1--