Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108813 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 19721 invoked from network); 2 Mar 2020 19:52:52 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Mar 2020 19:52:52 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3857118056C for ; Mon, 2 Mar 2020 10:11:49 -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-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 ; Mon, 2 Mar 2020 10:11:48 -0800 (PST) Received: by mail-lf1-f44.google.com with SMTP id d27so289871lfq.12 for ; Mon, 02 Mar 2020 10:11:48 -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=8npPtZjPP9lybCVQLa7IciVGAEQ5V0sZwkdZj/gplhg=; b=GpiuGXYNBdIxoNxXhWAaUZ2ZH8qMFVDqiW0K1a4UvJDucABMmhTNQoxgjz1PR9adpB zfp2vZr2qJrLZtVSynwgROr9t6PiWm45Xz3Ag5tL/EX9P+erRwEELOfkp9CG0BLR2jKz OoABFssUoA6FnowYarRuvAxOZn0fQhPVi/TO3VNaML7jaxo36v5ATiEaS3cB6MrQnZmz 95djzLrcOcEbFLblmTZHPlzmYuXi/uFXx/YLALuXXTqtw5IqKoYHe+dNvBE+PBHS4+xx jWio+6TT+AZ9AE9yzJk4Btn9hvYY1wxdMDgjUcu1GGlaXF3vXsM7ZN5Q2T5T4vIdQi6U 7cww== 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=8npPtZjPP9lybCVQLa7IciVGAEQ5V0sZwkdZj/gplhg=; b=KDMx4zzSHW1YzFoc/gYBbP21bsXsc3pF2GXpS2Bi/aTThlYtWeThJq4OA+DuHSaWUt 3BXiwFsGBEmOSYeSdkDYfSr+BPHLxKOV9+8Peioa3IuGndXuO1AXLRtuqiJxbfzl7mEu 8JRAmiPW1Vgesyv6xe2E8v6IfLgc7fkOBrnkvCvItQc3bMu/6hnz9cNgiZIdQ5vRMzRW Lcx04j0Ozl4g5BRJiM0OUL6P938ECJkkrq0FwO9nv+nyQarzgMYRg4CDxNAGwQSgXnUO MGmqcpy/JfsaW7X01UCzqbq8H5Fm0Fi1M1s1FdUiSEsCQD2wrYZqRwVc6hTrx47QiBuC Ar4w== X-Gm-Message-State: ANhLgQ0CxfZnDmICEBovZ4srtVJCuvUtygEzWSICbwEh8IENDG2nsXSg K1Wwqznj3X7Kt8cenD0m4k7dLWwUIsuxp/w4K7aUWFf1icM= X-Google-Smtp-Source: ADFU+vssEtpBbdaj4tKOeeNqtVuM9knsOKnVK4mKvl/u42GzZ+BXgjpg0SjEOH2HvO7jIEVfjxVQNpH6KaPNNgZ5CE0= X-Received: by 2002:ac2:551d:: with SMTP id j29mr214932lfk.81.1583172699910; Mon, 02 Mar 2020 10:11:39 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 2 Mar 2020 19:11:22 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000657697059fe31e06" Subject: Re: [RFC] token_get_all() TOKEN_AS_OBJECT mode From: nikita.ppv@gmail.com (Nikita Popov) --000000000000657697059fe31e06 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. > > Regards, > Nikita > I've done some final updates to the RFC ( https://wiki.php.net/rfc/token_as_object) and intend to open voting tomorrow, if there are major objections. The last changes were to clarify that getTokenName() returns null for unknown token IDs, and to provide some more extended rationale for what the individual methods are useful for. @Michal: The reason why it's called PhpToken is that it is ... a PHP token :) At least that's what it is intended to be used for -- while you could technically use it to represent other kinds of tokens, I don't think that's a usage that should be endorsed. Just "Token" is very generic, and not even specific to lexing/tokenization. The term "Token" is commonly used in other contexts as well (e.g. token ring). Regards, Nikita --000000000000657697059fe31e06--