Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103739 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 70308 invoked from network); 15 Jan 2019 13:54:40 -0000 Received: from unknown (HELO mail-it1-f182.google.com) (209.85.166.182) by pb1.pair.com with SMTP; 15 Jan 2019 13:54:40 -0000 Received: by mail-it1-f182.google.com with SMTP id b5so3699355iti.2 for ; Tue, 15 Jan 2019 02:30:31 -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=2sFYyS69y1JwoeLXxybFWkPn1eGtva0IodHr8JQjgXQ=; b=UoSRLfvgcH29FjLFDSPu5WefBBUw6z/vPg+43Q6nh4BzyXE8gkZ/+qqYg+oAHCnHDT EfX51qb/kwtG5knV0lh8YFXjg/P4OH3eizwBDgeWMemOcl1fK23NV3qXOujzyli59Jif bWh3KMfbZzqtAUloBobNYCL1tzJI8DpWrk2Jc6kdIhN5MA4ZqH8VRHWOrKwBZss82f2y vAKqBHI4iCK3pGWd5zEGC5819enWmB+Edv03PuitGEauH8NBvDhLlSEnuC0KlNUbb2u6 GXdVcMNnic4ZlZbY+CDnKAnow5ZbMAsA4en1pFo6Tz2iAYrSy6Q68MeePmFkzaplV3Ow sSHA== 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=2sFYyS69y1JwoeLXxybFWkPn1eGtva0IodHr8JQjgXQ=; b=oS6MWq0W8L9Ixd4l6NuRIw4jECO3npU66oBI4I2snTXKbdsV+CWkY9PexxUdP8DI9x Jp38XY4CAFflMkTNkXBpM6swvys8XRfEVh9vWOALS2iK4C8rrFo35GdemJkUHpf8qwdb jE4pne6wxbtApfF/gnFAhyNlH+X8snbkvdSiwYP8wVRPh5m1yy8/xmth0EQDbwUYrGIL ODIqNWyLltVxqTL1Nq1EXAO7bk6tP9g2RbaB+NkDwsUgnG/LzWOfVuripWdJaNkNE9Wv tSlLyBuSXni3HAl+g4ncvgVpb7/EXsTpYQV8c2UAaf+bWDT6NsCdRXn9ST0wQmBbSU2Q t+YQ== X-Gm-Message-State: AJcUukc6GV20/yNIBbiAsVBmhwMh3cb8Q/M70ayYuXSCckt1WIDK+3Se ERTlYs0v1nm9NBxomR/wYnyPHNXj3oTweKNSReI= X-Google-Smtp-Source: ALg8bN75dwzqf9N4IjxVjy94f6DjYWCMtR47BeF8DiE9LyPYi5DSp7hZBOMNDbLwtUyMJHqtiWf8G6xuCyKBQRRuFww= X-Received: by 2002:a02:6915:: with SMTP id e21mr1709334jac.142.1547548231199; Tue, 15 Jan 2019 02:30:31 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 15 Jan 2019 11:30:18 +0100 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000097eecd057f7ca6fd" Subject: Re: [PHP-DEV] [RFC] Reflection for references From: ocramius@gmail.com (Marco Pivetta) --00000000000097eecd057f7ca6fd Content-Type: text/plain; charset="UTF-8" A few issues with the RFC so far: * `ReflectionReference` seems to be designed around arrays only: maybe `ReflectionArrayKeyReference` or such? * Can the `getId()` return type be restricted to either `int` or `string`? Why is it a union type right now? Technical limitation? * `ReflectionReference#__construct()` should be `private`, since it is unusable anyway * `fromArrayElem` => `fromArrayElement` * is this open for inheritance? If so, what scenarios would fit inheriting from `ReflectionReference`? * what happens when `ReflectionReference::fromArrayElement()` is given invalid data, such as non-existing keys? I'd expect it to throw. * instead of `$ref1->getId() === $ref2->getId()`, `$ref1->matches($ref2)` or such. * what are possible scenarios for getting the identifier as a primitive, and then storing it somewhere (like an array of reference identifiers)? * 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? Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On Tue, Jan 15, 2019 at 11:16 AM Nikita Popov wrote: > Hi internals, > > I'd like to propose the addition of a ReflectionReference class, as > described in the following RFC: > https://wiki.php.net/rfc/reference_reflection > > This topic was previously discussed at https://externals.io/message/102638 > . > The TL;DR is that some libraries need a way to detect references and > determine whether two references are the same. They previously used an ugly > hack to achieve this, but this hack will no longer (reliably) work due to > the introduction of typed properties, so we need to do something about this > for the 7.4 release. > > Regards, > Nikita > --00000000000097eecd057f7ca6fd--