Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107059 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49614 invoked from network); 13 Sep 2019 11:15:46 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 13 Sep 2019 11:15:46 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 9AF0A2D1FE1 for ; Fri, 13 Sep 2019 01:51:52 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Fri, 13 Sep 2019 01:51:52 -0700 (PDT) Received: by mail-ot1-x32f.google.com with SMTP id y39so28768955ota.7 for ; Fri, 13 Sep 2019 01:51:52 -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; bh=tbLNGYzRx/z49zsDjS9s731IH1hMgeBsztaXdXdGc6E=; b=bHIW0Dsmyjewv9Ffwyc6k6Naw0/D2zyMm4wpIDCyOSb1b5GhHI98SROdIS6+ywlgLS noYm5sRChNYU9Gp7GapxEgmMxCPy5ai/Mu6ZYDKDH5aZ3yM4G/GJp8Navz4S3fk5l4m0 dX2Rh0xC/i4qHJNDqGxdTAEFlIgdtfU7prEsS0J6aLSbqojCMbveErJTakbTbL4z+YwZ Jd1i6Wtff8m2RibPk2zDApirjMKFOVFXTOWW0He2jERLn5/vzdMjO0USkichNmeatZl6 Yjt0jVDEKxIA6dk40jjIbw9OjKaEaSXKLur7MR2txsnYtnKCYxo8be4/jlJb9gAbgPWI FITg== 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; bh=tbLNGYzRx/z49zsDjS9s731IH1hMgeBsztaXdXdGc6E=; b=fW8gj98zuVqdwsfgYz/tCNWgG2UQw9gYNEj2vm6fT0DXNkWKUW5/Wy9XAlJuksAOVM RISEMJB3PUAGdSdA/iIBg8r/M/IveeOICyhMWxk/5+LgHe/nvMt+vlumszMY/EPAwE6V x1xV12emdNKnpjdarmJidFtGlXPWpu+jWNcCKz3lNJliFVM+svzlNaZfO5WwWkdixNO/ 60ddDhoCL2Bqjohst1yqIhrvNpsJZ7HkdoIKPjY8uzWD2rMF6G3Xwc1ZutXC3yOzGA7O tvDoXVOiuL/w47sDJyeHAmyz13KH6LgjJS2kVkyM+HVXfXn6RWUyf5BwMp2QtqN4hiXs ahIg== X-Gm-Message-State: APjAAAUT0lUD7EwavXGEdDz14LBh6jNtbbJae/bOUW1CEUFVBN1Ydp2d PUo7J2LRl/840+lPfjA/ICPc5o+zwz6HqzZ3nnFvIfxQqyg= X-Google-Smtp-Source: APXvYqynN5SbyFJZwo9COaz1T/u/vcVNQqbeARKZX2o6s1k+U4A6JcJLtFemSIWvWqAeR31QWJNaGPgcs7CWkd04CrY= X-Received: by 2002:a05:6830:189:: with SMTP id q9mr5077690ota.273.1568364711232; Fri, 13 Sep 2019 01:51:51 -0700 (PDT) MIME-Version: 1.0 References: <74C03BB1-28DF-4694-A91D-2516C545F8B2@gmail.com> <3CA484B0-BCA3-4A2B-B2A6-8B845F9C462B@newclarity.net> In-Reply-To: <3CA484B0-BCA3-4A2B-B2A6-8B845F9C462B@newclarity.net> Date: Fri, 13 Sep 2019 10:51:39 +0200 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="0000000000007dc9fe05926b5d4a" X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] Object Initializer From: arnold.adaniels.nl@gmail.com (Arnold Daniels) --0000000000007dc9fe05926b5d4a Content-Type: text/plain; charset="UTF-8" This can easily be done in a number of ways, like the suggested helper function. The same can be said for many other features that were implemented recently, like array unpacking. This feature is easy to implement and will make the code for data objects much more readable, with additional benefits for static analysis. Comments: I don't like how it works for anonymous classes. It's more difficult to implement since the compiler doesn't know the meaning of the (first) bracket. It's doesn't make the code more readable, for the same reason. I think it's better to not support this syntax with anonymous classes. The examples do not show how constructor arguments are passed. I'm assuming it's $customer = new Customer("foo") { name = "John" }; About the idea of letting `{ foo = 10 }` create an `stdClass` object (not in the RFC); While not used much since it has no effect, it's perfectly okay to put your code in brackets eg `{ { { $foo = 10; } } }`. As such, I don't think it's a good idea to allow `new stdClass` to be omitted. --0000000000007dc9fe05926b5d4a--