Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120072 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 30918 invoked from network); 19 Apr 2023 15:27:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Apr 2023 15:27:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 532A91804D4 for ; Wed, 19 Apr 2023 08:27:11 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 19 Apr 2023 08:27:10 -0700 (PDT) Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-54f6a796bd0so3155187b3.12 for ; Wed, 19 Apr 2023 08:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20221208.gappssmtp.com; s=20221208; t=1681918030; x=1684510030; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=HPMNHmRYHxJ9ta85wUgN3aM4L9ETZtXZmiH0iGLb/Vw=; b=o3wiOThz688P/dA6zzyydQh+Yseoa3gRU9GxYjE13zMgssMfGr7zogb8OQyqeM+TxO AQ82F9HRfLtF1wqijMgadHydIfmaGK2jlqKn3VBo2gt/YcHl66XzMHsrq7eFtvXO/dVu vf3T3s4DCHiVGmWZUtAuoTGUbZ9i3M3/5dt0UqjYzpAjbjkRb2JDGaAyttibOopsMYgv 80JXf0JxjFuScp1yBrJAfMYkiVRZN5Ep+ohEpCOHu8tr0ULkXH8Fq+kX4eewaMzDksKc 39L1eMBPCIivhTnTxwYu0ike5NRCxIl26Id68MDt535E5rmKtSpQ9JPxXrePTyl9TaXf FYCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681918030; x=1684510030; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HPMNHmRYHxJ9ta85wUgN3aM4L9ETZtXZmiH0iGLb/Vw=; b=ZixVzNcV7e2ya4uvFt3oL5421SJFRlZimOQ3oiOHOrFio8kYeIolg87A4+z0sgaeG8 sllFM2EY2nbPVTw3kMEh/Sl0/2mz5L1nc7cBSD8o0uniwpqZdPKB/LJGXhbgsJWkWbbk kk4s48UBQbfXEwxWo2HLUwYb2hcejGkCAYOsYc/duLzxT6/hIqFesAyqF8mjHh0hGVLM Nbh+qc+5wQwOrX5U6SonR0bdOrRveX4tw+hJErV5r9c8d2oS3IahqNliQtumXtUAPLac QF7LKTxTdW6iK0PrmJmRErPKRzxbHlsIV2OSexcG/i8QjxuhykTb2BlrH+oYtv4NwGtI p+PQ== X-Gm-Message-State: AAQBX9d5+QGUBWZ8RIkOek6MczUqw5wttAzRHP9K8+fQauYF1l4I+Z3x IiHhLovSaIoWoa+i+CRJD9AXMOukA7NcG572YyrwfA== X-Google-Smtp-Source: AKy350Zz2saXaEh0vjMhRSCr9YC6l4/ufzuFzKHcj/VuIM6QvfkqRdfnfFYjkvsXwKhM56rVTQD2pB+ZSJ12n0/4FMQ= X-Received: by 2002:a81:4b4e:0:b0:555:ca01:b279 with SMTP id y75-20020a814b4e000000b00555ca01b279mr2456008ywa.26.1681918029700; Wed, 19 Apr 2023 08:27:09 -0700 (PDT) MIME-Version: 1.0 References: <687944e3-75ec-446b-bbd6-6d3d6856e864@app.fastmail.com> <1b842b25-c038-f647-67e1-b8c986b7d51d@bastelstu.be> In-Reply-To: Date: Wed, 19 Apr 2023 17:26:58 +0200 Message-ID: To: Bob Magic Cc: =?UTF-8?Q?Tim_D=C3=BCsterhus?= , php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] [Discussion] Clone with From: andreas@dqxtech.net (Andreas Hennings) On Tue, 18 Apr 2023 at 22:01, Bob Magic wrote: > > > [1] In fact if the right hand side of with may be an expression that > > evaluates to an array, folks wouldn't need to learn new syntax at all: > > > > $newProperties = [ "foo" => "bar" ]; > > clone $object with $newProperties; > > > > and > > > > clone $object with [ "foo" => "bar" ]; > > in my opinion this is sick, as in awesome. the {} version makes no sense to > me unless the language gains $var = {} ; to skip $var = (object)[]; I think the {...} is meant to be simply an "argument list", not a value. But yes having an array here would add some flexibility. It would also give us argument unpacking for free. I wonder what this means for performance. Will the expression always be evaluated as an array first, and then applied, or can php do a "shortcut" where it internally treats it as an argument list, even though the syntax implies array? The different will be small, but it could become relevant if called many times over. -- Andreas