Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107391 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 1226 invoked from network); 7 Oct 2019 10:07:31 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 7 Oct 2019 10:07:31 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 716AA2C052A for ; Mon, 7 Oct 2019 00:49:33 -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-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (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 ; Mon, 7 Oct 2019 00:49:32 -0700 (PDT) Received: by mail-ot1-x330.google.com with SMTP id e11so10174056otl.5 for ; Mon, 07 Oct 2019 00:49:32 -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=VCN/7Ug46fm3YtMKtb2E/UW9TK14c3eruZUtDpbHlOQ=; b=U1PdwkQe/TysTVB+280wBcCFfrVpsFEI+/2skppva3MAwgPLH4H9i0KVEHSIamyIJI pRstR6HNSoH6qXubsoLBQq3A3KNajlhjuV9CuLV20co0uVDKSDq9BDXYHkvbRDruySGT C/hGh45HQFFZQcZCu2dicXQtNnOQyxApIJZjR1Ki19/5WfTY3YJmGGBxDm48JCZSCeOp YRNj4zkWxSWjSNB7h4N1ZLqi8JeMPO3aPmGHeAsnGjE2WLE4rBieVsTBBDuFjbQWHW8o mbeu5C5y6CkuiK0LGDj2U5msN7A2FAFzspiBotQ7zn/19Wbb69sBclw4qGLKbTwBAGBM BAng== 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=VCN/7Ug46fm3YtMKtb2E/UW9TK14c3eruZUtDpbHlOQ=; b=WXSjJut5IOjbs3gB1JKOepYCaUPDPPM+BEW4le7XS2xEtyWE6bFcB2T3JAArVxdB3z PiMj/39HiXJ5PSf7LGgZMlgCNYVUEbP4TvyRJN51MbakqzH4Gevu6IlMaMJ1vd99nXEX /ix/NxrGJCR7JoxXO0zP2QevsgOMUoxme0RWIiYlrA9qSW3aWJcI9bekpqj939+PnkuT +grgJtsuEsOvO9MnkjrScAXlIudQtL8NFHF8/He81NqvSpGVXVvCpikKn+kUGokNcwtm O7SiFL8nRbvPZyrzcaI+VAxUQ+SZdaYG7qZ3cq8nTfSRy9eJ7xCuBDQtbAaot/9S5XKR hdvw== X-Gm-Message-State: APjAAAVjMr5gBiBUp45KRugUBzC/kucsCA7hkxgDc0q7a0mGLq4OebHv 6VI3FAGkip9f/6oAf+E3GAcdNK22Lh2KEEDhSq8= X-Google-Smtp-Source: APXvYqziYqqUFbrFdsY9mN6JlOkB4/cPbqE8MS0NOkHqp2ZkyFrRdkAAdPXKl768DX/dvddiSFlMIe0yaAaX9mMPXKs= X-Received: by 2002:a05:6830:22f7:: with SMTP id t23mr20879930otc.258.1570434571785; Mon, 07 Oct 2019 00:49:31 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 7 Oct 2019 09:49:18 +0200 Message-ID: To: Arvids Godjuks Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000cb59dc05944d4a89" X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] Object Initializer From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --000000000000cb59dc05944d4a89 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Arvids, sorry for the late response, I've been busy recently. wt., 17 wrz 2019 o 13:08 Arvids Godjuks napisa=C5=82(a): > > I've have been keeping up with the thread and at this point, I do somewha= t > agree with people that maybe the RFC should go into V2 version developmen= t. > It really seems like the scope of the RFC is just too small for the featu= re > and it might be a good idea to expand it a bit. > I'm gonna let it go as it currently is, there's still time before PHP 8.0 for improvements. IMO with all the goods like list of properties to set and restriction which forces to properly initialize object instance with all required fields is enough. > Also, I have this question - is there any performance to be gained here? > Cause right now object hydration is an issue and is somewhat slow. Can it > be optimised? > Also, usually I don't really want properties to be public (aka writeable)= , > so that means `private/protected` and I need to use the methods to set th= e > properties or reflection. I might have missed or don't remember it, but I > don't think I saw a discussion about that use-case. Value object, DTO's - > all have a big use case for it. > This feature has no implementation yet so won't speak out about performance and optimisation now. Declaring classes with private/protected fields doesn't mean you cannot to object initialization using object initializer, you can do this from class inner scope exactly the same way as you're able to access them from class inner scope now. This feature may not be a cure for all diseases, but I believe is the right to reduce noise and boilerplate when instantiating and initializing simple objects with type restrictions and ensures valid object state every time it's used. BR, Micha=C5=82 Brzuchalski --000000000000cb59dc05944d4a89--