Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109087 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85360 invoked from network); 17 Mar 2020 03:07:07 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Mar 2020 03:07:07 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E1E5C1804C5 for ; Mon, 16 Mar 2020 18:29:40 -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=-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-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (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, 16 Mar 2020 18:29:40 -0700 (PDT) Received: by mail-il1-f181.google.com with SMTP id k29so18588989ilg.0 for ; Mon, 16 Mar 2020 18:29:40 -0700 (PDT) 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=zn5QIYHCV5iGnY6r19jSEGFeLicvceHg9bpUfozn9XY=; b=hPxIWtFiuUDQdpdi8oqHeIpTz6o2x4Qlx6iw/NbjR5tdBISl2b8GH+PqZwMs2MggMS CK3Z9fSHxnwwxRftpI4BRQj9aJ6hzZfRNt7BeGfI5Z7wszHzkoMnFQn5olsVidHxebR7 /8VGbLHFowxZ2ZDxmR+bykiMuisJHc5P+3/6YGaqt9MJIFnFW+2BWzX/QW4e0CSLngl8 wB6Wui13r/dg5oDPCoh6xUcNo67LkuhvOdKIBYPgRIH23i+7XU2r2bw9w1oYAPlG+kfn Q2usNn2O4KuN2T1/QsfIElW4PJ+uCq8bIws1k5/7iiiUcp7020dAj8p9RLJCcC/1b/rW wGZw== 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=zn5QIYHCV5iGnY6r19jSEGFeLicvceHg9bpUfozn9XY=; b=GvM9f5uvrZfia9Nw2m6Uhb6Ow0Vgo2zU/6d2HEKYJCZ6/UxcGuUvQR3LDLxLArdsKc Xa9cBnH2734imS711tlMHj0MImZC6VuLiAMWRwLGZ+ynPRbdefpEzJ1unvhUCazryeWH E2sAMCV3xgEgI3jfF1s4O+Qe/0V8RmrohjPKhhbrW7VZ1S9abve8ykeKVDluyGxQpHYt z7SED7hI2VFGc7c0tJWwH7GH2RxbV7CIgdkC4C3v3AhZXEZM5DFtLMlq7VqgPWxN93tK k4Lc66lKvI67SW1WvhBtWAIn+qAaOywqxjMnoPxUWpR7vHrkIHanB7+hPR+9L7AAe0Vi zdvA== X-Gm-Message-State: ANhLgQ1P+AdILNNhxQcqQmK95FAEoVv8yLkFODhuBNeLhuE2eswmdDom 9ACESSk8VpMvwviGo6xNdXLybGPQ0K92lXjIGi37n8F9K6o= X-Google-Smtp-Source: ADFU+vsdG0zjzS6CWiE80K4lS49qJf+4BxV0xTlkWb270fsitjVq2PZK5yAj+pdr2lC157KTqCZKhceX6fpQrr3J4Tw= X-Received: by 2002:a92:1a0b:: with SMTP id a11mr2540351ila.283.1584408577411; Mon, 16 Mar 2020 18:29:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 17 Mar 2020 02:29:25 +0100 Message-ID: To: Jakob Givoni Cc: php internals Content-Type: multipart/alternative; boundary="0000000000006f924c05a102de78" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Compact Object Property Assignment From: ocramius@gmail.com (Marco Pivetta) --0000000000006f924c05a102de78 Content-Type: text/plain; charset="UTF-8" Hey Jakob, On Tue, Mar 17, 2020, 02:27 Jakob Givoni wrote: > On Mon, Mar 16, 2020 at 9:31 AM Marco Pivetta wrote: > > What happens if you have an expression that throws? > > > > class Foo > > { > > public $a; > > public $b; > > public $c; > > } > > > > $instance = new Foo(); > > > > function iThrow() { > > throw new \Exception(); > > } > > > > try { > > $foo ->[ > > a = 'a', > > b = iThrow(), > > c = 'c', > > ]; > > } catch (\Throwable $e) { > > var_export($foo); // ??? > > } > > Hi Marco! > Trivial question - let's see what happens: > > Just replace COPA with the old syntax and run it: > > try { > $foo->a = 'a'; > $foo->b = iThrow(); > $foo->x = 'c'; > } catch (\Throwable $e) { > var_export($foo); // ??? > } > > Result: > Foo::__set_state(array( > 'a' => 'a', > 'b' => NULL, > 'c' => NULL, > )) > > So the first property will be set, the rest will be left as they were. > That kinda makes the entire feature quite useless/uninteresting to me: if a this does is desugaring into a set of assignments, then I'm not sure what its advantage is. I was kinda hoping for an atomic state mutation across multiple fields, heh... > --0000000000006f924c05a102de78--