Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108755 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 97271 invoked from network); 25 Feb 2020 17:42:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Feb 2020 17:42:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 551911804A7 for ; Tue, 25 Feb 2020 07:59:59 -0800 (PST) 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,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 25 Feb 2020 07:59:58 -0800 (PST) Received: by mail-lj1-f180.google.com with SMTP id r19so14616694ljg.3 for ; Tue, 25 Feb 2020 07:59:58 -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; bh=Hpg4gSojtay3WUSaeHCJnK8+OcU8aILbqY1WFCSqQNU=; b=HrWolfU8KJX5CCgyj4fVQCWHgUPbsbqWJR1uKQMI8zY/Lg6KpMmD3mXvz5/Meu296a OGXego7eOe8xLXvl7QIlTmJa2e8/uttCcCpnhx8t9i3BOLJtg0MpbW7DqPxw31RiinlY NKzMHSeCnvPJI6E2D1f9yZzYilE45SwrRM4wI0cHpGgGxHWFRi7g7+ylIllloYWUU+Cw nSfr+6xJ/6YJVXXNsinoSpAqwYm1YD78ND/qIjrmC2U8S9kdtsaBT+mxeQTbyukValbu ij5PYi4fN6/G2YFO+uKd8qhfxHxnlpfOY08nD3yUZXKKMpY76a4vf/EASOdEyZtTQEL3 JcMQ== 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; bh=Hpg4gSojtay3WUSaeHCJnK8+OcU8aILbqY1WFCSqQNU=; b=DyyDal09LCHTdtYBHWX1wv0ieQOjrekn1q54clJuQwkqWpPi4GHDRHLGXCJVE31WTn N+6S30glVNTkx8LBLvRAPeOlXA0+mOplQKS1Xy+jrWwZQSgqv6Xzlfls7OvEKuTjMTca HATXwOluvn39e9uLcNalTbQ+e0kJk/C+HAt7X+NPcjQvUBCb3sYzlO0Kw3TZHe2mc2AA 8kXor+OdS/sgWa829R/sxcp8EngqvMRo3kCU57g2CE79OvBHMv61ckdJJLjQJ7jquJKp aYSWcgKSy9m0mbK0JjwZM1s1O4WA8FZFICFPx0T2ANh69GXESktb3tJ0/pDWN1A0qPt/ ReGg== X-Gm-Message-State: APjAAAV935x1Sy+e40x71uLbfZDWytoJC9qqOrdWTs/D4FQIlmbDoBRR 7XVi8yfsMMb7m5jyMUzloJnLt9kfcAQcNwn3vyewt6UD X-Google-Smtp-Source: APXvYqz7lmn8Zb/H8GOPHytFENtVK+9g0c3XhYIFujpWwIby8Uj0SioB6e2x9TMi38XhET61hiMAeJkuqP4Poom0vOs= X-Received: by 2002:a2e:2a84:: with SMTP id q126mr32728693ljq.258.1582646396052; Tue, 25 Feb 2020 07:59:56 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 25 Feb 2020 16:59:39 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000003df079059f689409" Subject: Re: [RFC] token_get_all() TOKEN_AS_OBJECT mode From: nikita.ppv@gmail.com (Nikita Popov) --0000000000003df079059f689409 Content-Type: text/plain; charset="UTF-8" On Thu, Feb 13, 2020 at 10:47 AM Nikita Popov wrote: > Hi internals, > > This has been discussed a while ago already, now as a proper proposal: > https://wiki.php.net/rfc/token_as_object > > tl;dr is that it allows you to get token_get_all() output as an array of > PhpToken objects. This reduces memory usage, improves performance, makes > code more uniform and readable... What's not to like? > > An open question is whether (at least to start with) PhpToken should be > just a data container, or whether we want to add some helper methods to it. > If this generates too much bikeshed, I'll drop methods from the proposal. > I think this proposal is in a pretty decent shape now, and I'd like to move it to voting soon. The only remaining open question is whether we want to add any additional predefined methods. As the class can now be extended, every library can add their own methods, but there might still be value in providing some things by default, primarily for performance reason. For example, the proposed is() method can be a good bit more efficient when implemented directly in extension code. Any feedback on this point? Nikita --0000000000003df079059f689409--