Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102629 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94452 invoked from network); 6 Jul 2018 20:57:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jul 2018 20:57:42 -0000 Authentication-Results: pb1.pair.com header.from=nicolas.grekas+php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nicolas.grekas@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.52 as permitted sender) X-PHP-List-Original-Sender: nicolas.grekas@gmail.com X-Host-Fingerprint: 209.85.218.52 mail-oi0-f52.google.com Received: from [209.85.218.52] ([209.85.218.52:46836] helo=mail-oi0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/CE-55607-5C7DF3B5 for ; Fri, 06 Jul 2018 16:57:41 -0400 Received: by mail-oi0-f52.google.com with SMTP id y207-v6so25800622oie.13 for ; Fri, 06 Jul 2018 13:57:41 -0700 (PDT) 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=KML/sEKgD6zVi28yR4pClmG2bDlIu1d1zQqg3T4s8Ic=; b=VloRoRwFaw+VVD7r2CqlMqfEhSyuIFvOH3wiJgD1pbILF6ICHu9wrNUkIlvF50KVB4 ULZIw/tZy+ZRiJ2+cvvJ2BoVgSsqxDvS8kXjZTROesAlp2xyjdr8KopmsBFV0FodyEis W00rU/O4vZBtsAH9lz4gk3DWIdw+ll11NTZGkkf/I0ZHEfOMnDzlTqStPchai+cZRd1u CueHqXojyHXCY5kdlGGxWkWilJoRf/6mi7ZWU6fUe+myVzco4dXj68xmteepxbgzqCVD WujLWOie/F7pgO5ES8MAXTxovFUmDpULHCkQU9kTHPLZmRdAgWvERj3qHbrl1tepjWfy LSUw== 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=KML/sEKgD6zVi28yR4pClmG2bDlIu1d1zQqg3T4s8Ic=; b=lGEw0GxCfvHaeBovnhlQ/jh0YIHkexGB/8LRSOI/3wfYjFc5yRowrd3tVKSbuUp73J cj/s4mSInAL2lh16p9QYsmeXpi3axPvyJLuy/DoWVDV7FgOlVS+zHx/fSBl96XJ5hx4Z 69EErJHQ2ya3bCmdOIdjR1cVBw3fXMXNaAPpnD7OngrjjrwbVDZLrYuC1VFUQMrpECCs CknTXeh9mt+7pga+Y6+7Aw12tqh77/2Y52jPpafOLIrr3zsR86lluJNS3sixgkQKkjXq bNcaJMr4qfrdbrkFoMnU//pYPrGSZvoMDpWTBBClHvJSUkmI8GpceEbuy46w1bHvAAF1 Bbew== X-Gm-Message-State: APt69E2Qu3WursjTDW9nngNlanSiJh9xtEtTk8l6mLAANLZYxaErofe+ YGEbJXXrTCcwAlAzDYexAvXCvbZahkxM77A/kwU= X-Google-Smtp-Source: AAOMgpcRHKF+42oV6NCHYzRXYz7JEmcSW5igoqWkmqE29KUFoJCCaiYF9VHw1GZ/6wbmeiTiL+/saTfM/Lak0GQeXR0= X-Received: by 2002:aca:42:: with SMTP id 63-v6mr11965120oia.154.1530910659004; Fri, 06 Jul 2018 13:57:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 6 Jul 2018 22:57:26 +0200 Message-ID: To: Bob Weinand Cc: Nikita Popov , PHP Internals List Content-Type: multipart/alternative; boundary="000000000000034ccd05705aea4c" Subject: Re: [PHP-DEV] [RFC] Typed Properties From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000034ccd05705aea4c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le jeu. 21 juin 2018 =C3=A0 19:37, Nicolas Grekas a =C3=A9crit : > if ((new ReflectionReference($array[$key]))->getRefcount() > 2) { /* is >> ref */ } else { /* not a ref */ }, for computing the allowed types you= =E2=80=99d >> intersect the types of the ReflectionProperties returned by >> getReferencingProperties(). >> > I just realized that this interface would suffer from a significant drawback: it would trigger COW when iterating over immutable arrays, defeating the shared-memory optimization provided by OPcache. An interface like new ReflectionReference($array, $key) would be free from the issue. Combined with get_defined_vars() and the (array) operator for objects, we can inspect any PHP data structure or scope also this way. Nicolas > --000000000000034ccd05705aea4c--