Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108556 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 25717 invoked from network); 14 Feb 2020 02:13:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Feb 2020 02:13:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 30C34180533 for ; Thu, 13 Feb 2020 16:28:00 -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,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-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (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 ; Thu, 13 Feb 2020 16:27:59 -0800 (PST) Received: by mail-il1-f169.google.com with SMTP id s85so6584723ill.11 for ; Thu, 13 Feb 2020 16:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8ZSUmo4WDUhmFREoRanpgUOCqp6HiNobb/o/GjGGNkw=; b=eGJ/pxBM6bpWCpyG04OjlBN2/d5M9kltiuVskP25zZuTwMwmmHsPDfIt7hdlSqrhxV mSWe2Nu60rgj5Vb/ENybt5IuceXrPtVPTqy/5lRS/Wq/nuTKijfl7psA8q7QlRvZ59Dk NOaBVyJe212m0HZaspOULr4bIBg0Zol7/77p4= 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=8ZSUmo4WDUhmFREoRanpgUOCqp6HiNobb/o/GjGGNkw=; b=HEeOIo2ryZjDPUZciqkLCwglgbKbkYiC01gqhSBQxgiLXbQKKq1B+d6mvDC+P8Bu1V LSVrN8zubvxfk3GSJkrlzmde90Vi+xJsundgyuPJWP1XUn0Re1yqhdxglISE9Xlc9XXx DKqmaB40MqR8v0Rz1LqcU9nYY2Vq/QomR0GaPqj0h6ltr56u7h1nv7c3jtCzI3rT9Dor ooehDZQ1TCrUlZNC8twqcZ1FYXIELif4Mx5qBc4g/mtrBQyDmQ2WfXHpwI5IYpAtpqQW nUDkrn0hUrFfwFj8Ctb+iew3kTPFjmWjzBmyHOkH4tx+oVF6UVeg+DAQtA4cbgWq8kzn Caig== X-Gm-Message-State: APjAAAWiautlmsmN4lvMugEgVjxM7h3vImRzavq6+6I4FnH0j+Rdtl5l pEwGka0QMvg5v/3iGrw5gHq+5ZmFNqvNW+a8dwg/Wg== X-Google-Smtp-Source: APXvYqxHpjeWnhIqGcrJnm/NVIoTNjjTLrjakVVr1jQ/fMe/7UDj34bBumm1ADL8Eh6pXIvh7HqRYkMCMUCXqeNPor0= X-Received: by 2002:a92:3a8d:: with SMTP id i13mr609538ilf.112.1581640076215; Thu, 13 Feb 2020 16:27:56 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Reply-To: Levi Morrison Date: Thu, 13 Feb 2020 17:27:45 -0700 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] token_get_all() TOKEN_AS_OBJECT mode From: internals@lists.php.net ("Levi Morrison via internals") On Thu, Feb 13, 2020 at 2:48 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 Overall it looks great. Thanks, Nikita. I do think it should use a separate function from `token_get_all`, and am not sure I care whether it is a function or static method. The only helper I see as totally non-controversial is `getTokenName`, which seems completely reasonable and users should not have to keep re-implementing that. I am open to more discussion about the others.