Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108600 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49153 invoked from network); 15 Feb 2020 17:33:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Feb 2020 17:33:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0825718050A for ; Sat, 15 Feb 2020 07:48:13 -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-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 ; Sat, 15 Feb 2020 07:48:12 -0800 (PST) Received: by mail-lf1-f50.google.com with SMTP id r14so8831928lfm.5 for ; Sat, 15 Feb 2020 07:48:12 -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 :cc; bh=ju8ZWRUCzi5zfdxPA0w5sEfIdsV2vVe4HcgXLFss25g=; b=FhkUPiioegtR1cqYE6mDShhcymcG+yDYBQiKyfnxfjVrnh3JhsubNkZXN9e8I+zWLA TAQcsi+Wr9F+SB6fV7x/6xqADx7jjq46Qb5zS7vGQxqFHStKrKiLeuhqcZv9OwryZT+w lcpxmN/Pyf9NQv73Jr78mi5tjfTOog3/iUwCFEIMJ2CIT1q49QAzNbjo8wjtm2PlRqFS F02TL7Hp/pyEGvmb7gYGB4R6FOjORgBtpP3j8PexqghiLZJ02o2SmBmLM2R/DNHssd/I LUf57qTnREZ478yTnhdSWZYObgDJ9m3/8l6CQIJlCEd+/Dr3wLLnl8M2xjRJLfJWZ3pn fi5A== 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=ju8ZWRUCzi5zfdxPA0w5sEfIdsV2vVe4HcgXLFss25g=; b=EIq1aVMQ8xH5IkFByeUB5ERi3xznc1rv8tWRH0gUK035oDFhsciZ0uc8uiX6aYwPu0 7u2UiU28GOIAqi9LQKtRaR9tAkSnMUBIjyG1AgS+LoSwaV9Y8mbHZcHn/JbLlEzwPY1+ xre/yBrj1wapiYerdZDtZo/8I/Ywm43a3+fF7Nc3yztWkC3omQ40lABFoy48NNrTWCak qSpZwDRARhPdUEGrDyotwZvtCisbCFDseZjL/P5enQMoVsCb4ld2gsolefsx9GSclUYC jKBC9iz0pHWRQ0gr7mk52f6JDyv8QU1dY4ang7zQDlFF59fC3ZasSQ4KNCEZGWXWPh5/ XPLw== X-Gm-Message-State: APjAAAUBWjEAJ3PNheO14E++pmd4u6al483HHkM9hQF2az+AiIPYJkpM r9fR1lj9lCVSktnLk4VocLPX6VoNaCO4+HkUjRU= X-Google-Smtp-Source: APXvYqyNvsbn87+8YuXF2UrdMAGUMLuZnHg/1y5YPpofuO1Gik7y1bWBdctcJnnY2zc0PQc16ZC/rjhJWbTV6cuNsIw= X-Received: by 2002:ac2:5e29:: with SMTP id o9mr4262883lfg.81.1581781690500; Sat, 15 Feb 2020 07:48:10 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 15 Feb 2020 16:47:54 +0100 Message-ID: To: Rowan Tommins Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000c6495b059e9f3f12" Subject: Re: [PHP-DEV] [RFC] token_get_all() TOKEN_AS_OBJECT mode From: nikita.ppv@gmail.com (Nikita Popov) --000000000000c6495b059e9f3f12 Content-Type: text/plain; charset="UTF-8" On Fri, Feb 14, 2020 at 7:30 PM Rowan Tommins wrote: > On Fri, 14 Feb 2020 at 16:33, Nikita Popov wrote: > > > This constructor will initialize the corresponding properties. Now, the > > behavior that would make most sense to me (if extension of the class is > > allowed) is that MyPhpToken::getAll() is going to create the new tokens > > based on "new MyPhpToken($id, $text, $line, $pos)". If we mark the > > constructor final, then we could hardcode the construction behavior of > the > > base class without introducing any kind of weird rules, it would be just > > the usual language semantics. > > > > > It's worth noting that this is how ext/simplexml works: the $class > parameter of simplexml_load_string and simplexml_load_file must be the name > of a class that inherits from SimpleXMLElement, and an instance of that > class will be constructed for each element of the document. The constructor > of SimpleXMLElement is final, so the internal initialisation logic doesn't > have to actually call it, it can just initialise the private state > directly. > Thanks for pointing that out, I wasn't aware that SimpleXMLElement is already using this pattern. Given that, I've updated the RFC to go with that option now. Nikita --000000000000c6495b059e9f3f12--