Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108756 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 6109 invoked from network); 25 Feb 2020 18:41:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Feb 2020 18:41:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A6F4D180211 for ; Tue, 25 Feb 2020 08:59:03 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 25 Feb 2020 08:59:02 -0800 (PST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 5F4662213F for ; Tue, 25 Feb 2020 11:59:01 -0500 (EST) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Tue, 25 Feb 2020 11:59:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=fhXfTD wLUAWXTxZ/2kl0kTak7JGBayI3Qf+ORra9Ba8=; b=I/es+yOGFNXm36xs+pJY5m wEy/W+IHu863AENQHGf0YjSNxnRZ+pwC/CoZfDah30wve9eUQE4fUvWHAkViNJc0 k30uDzy6/XsSW3H29M0wQgVzoqFQGXzd9QwP7OAFFOUJwQqNQ7jGMGrtB+PPfFbh /ziZAU2ujD30kAjBoEg62WysDPu0j0M2w8anwAKeHKOx3CE8GXWV570cfyTyMlMF 68sc6rTsnb5KMOwADgoTD/71ZiLj6vNKcruCJqsyBhZXN+KAq7OO7cQSI4xgz7nX sJhZX/UQeT4UuRnVie4zKDO7rHWzg5BwQ/bPbgkG/Jgh2QKplnRn9yv1vnpDMT5Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrledvgdelgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgrrhhr hicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh eqnecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id DBEF514200A2; Tue, 25 Feb 2020 11:59:00 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-947-gbed3ff6-fmstable-20200220v2 Mime-Version: 1.0 Message-ID: <37fe0afd-bcfd-4719-9261-3fa1e758b6ed@www.fastmail.com> In-Reply-To: References: Date: Tue, 25 Feb 2020 10:58:12 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] Re: [RFC] token_get_all() TOKEN_AS_OBJECT mode From: larry@garfieldtech.com ("Larry Garfield") On Tue, Feb 25, 2020, at 9:59 AM, Nikita Popov wrote: > 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 Seems good to me in its current state. One last thought I had: in its current form, it *seems* like it would be possible, in concept, to create tokens directly via the constructor (ignoring the positional values), then have a generic render command you can apply to a list of them to use for code generation. I know that's not the intent here, but in concept is what I described possible? --Larry Garfield