Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107075 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 98041 invoked from network); 13 Sep 2019 13:50:58 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 13 Sep 2019 13:50:58 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id CE5082D1FF1 for ; Fri, 13 Sep 2019 04:27:06 -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-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (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 04:27:06 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id n197so62294189iod.9 for ; Fri, 13 Sep 2019 04:27:06 -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=/pYDsNfbz/4Y5fu68pUaZ9eFf+K0qEkPl9AV3xkFP5s=; b=EMyTxW6/cJO1pDrFZU7QrDjghE5tgNoiY8OMhcxNpKYT506IRTmo+zpu4VFlWkLEuh 6Qq2osb8FxwWxSWBT07xpPlkO/afPOayqdlPgAHMl6lPXNHv/O1sbUBpL5cGAY0+6uaj +Bacriy5EEr5IZ2i1p7eSjDnrfRVWIuSMAtknXS0Q62b2wEcuZ5h6CedV5RrsZIdpfDI 7FOx6v/t6Gxe6ldyw96YIPCQPfzdNj77z5mnow9AJcQSB3S1w4bX4mCt8Gt/Pq1Y4tI7 npncewS17JN3OP3/fFYhfY3jnA+vPkDiLz7dxb+NIKWNFjPc/eCxHCQTYEeyQpz/pkDG fqHg== 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=/pYDsNfbz/4Y5fu68pUaZ9eFf+K0qEkPl9AV3xkFP5s=; b=fndDsYV7FIVgqXGv44Je4WFWH20IYJrkWkRIttgnoxEW31j/9u72v00MK5dY1K9hF6 oRrwmxZ+xjo0imZtgbwUn5gd95WwOxWLDrdu/YwTdXJa9S9SOzmLJ4jwFUVBnlLfnGyZ RdgCOQ6Hw/yBw9NHRNH0r9bMaaAgpV/Hh6Xj5T/9VCZB/+XpmCr5NU5LWg74ovE1EPYV y39RI+B7PMh1PX0xPI1S30tZcMi7n87hJYQ6xhh4xhmJbLoSRAXqtJjEKnU69sJkFQMk JznNDSEUsZy/hjdmiLPuW/OH7OsKemxpOx0jVO8jfGU52Um2WRMXABoLGwL1xozSJnXp GXrg== X-Gm-Message-State: APjAAAVkLPtoBI63PuV7KNtp3ufN+ReUzhUoU711tWCQzVck5iEAn5Sh cGf2loqIFTBPJNtTupHohD1vkYW9Ny6fOj5dYgY= X-Google-Smtp-Source: APXvYqyVtWi4ibCg0A7SkmZhAqDSlptNBLnNwn53uE27EdyQY8jbX6nosJJHYw7Hi1zg271KoqsILeVqkUTkKRvl2RQ= X-Received: by 2002:a6b:b704:: with SMTP id h4mr5427063iof.218.1568374025643; Fri, 13 Sep 2019 04:27:05 -0700 (PDT) MIME-Version: 1.0 References: <74C03BB1-28DF-4694-A91D-2516C545F8B2@gmail.com> <3CA484B0-BCA3-4A2B-B2A6-8B845F9C462B@newclarity.net> In-Reply-To: Date: Fri, 13 Sep 2019 13:26:39 +0200 Message-ID: To: Arnold Daniels Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000ac6b1d05926d8829" X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] Object Initializer From: kjarli@gmail.com (Lynn) --000000000000ac6b1d05926d8829 Content-Type: text/plain; charset="UTF-8" On Fri, Sep 13, 2019 at 10:51 AM Arnold Daniels < arnold.adaniels.nl@gmail.com> wrote: > 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. > If the compiler implementation of `$foo = {...};` would give issues, `$foo = new {...};` could be an alternative for run-time declared anonymous classes (preferably with typed properties). In regards of stdClass, I don't think this should be used. Regards, Lynn van der Berg --000000000000ac6b1d05926d8829--