Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:115973
Return-Path: <bjorn.x.larsson@telia.com>
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 18585 invoked from network); 6 Sep 2021 16:59:32 -0000
Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5)
  by pb1.pair.com with SMTP; 6 Sep 2021 16:59:32 -0000
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id B717A1804BE
	for <internals@lists.php.net>; Mon,  6 Sep 2021 10:36:47 -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.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,
	SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2
X-Spam-ASN: AS3301 81.224.0.0/12
X-Spam-Virus: No
X-Envelope-From: <bjorn.x.larsson@telia.com>
Received: from ts201-smtpout71.ddc.teliasonera.net (ts201-smtpout71.ddc.teliasonera.net [81.236.60.178])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by php-smtp4.php.net (Postfix) with ESMTPS
	for <internals@lists.php.net>; Mon,  6 Sep 2021 10:36:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telia.com; s=tssemail; t=1630949807; 
        bh=ldR1Ru5CT3WvA4J/d3nXA7OLTA6YmMa+68nJj0jMbZY=;
        h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To;
        b=asHeMLdsZQnBYNYIvbyXLYbkm7TTACrqKS7VxL6HpAE+OpvvVxdzctbdXOugBLoL8KeuHnbkQUjN8jQ7b3p/p57R95zr6+npLJMxYoe03W3Mqi8+dsEh227Xm2ItqwBWoySrZ5lmkS9gDzpQhrgUviIvqwtQNMPDfBrwt7gvI+NXp8gCNLx4xgZx6C36oW/uH9a0gIJDFJMLjUPxs7hKetUsHdAuNFFARxvIdYD65uAaqw0v+aaBKGqB9+rzda/u50bvSxGchV8b/2kzvjQhJdI3vtdb4zV4RGoJGNLDrKKqUKtdJXdnRqBIDRT6+EjMgZkMmrRZo2eWaJ5tkooMPA==
X-RG-Rigid: 612E0510004466D1
X-Originating-IP: [213.64.245.126]
X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvtddrudeffedgudduhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfvgffnkfetufghpdggtfgfnhhsuhgsshgtrhhisggvpdfqfgfvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeeujhpnrhhnpgfnrghrshhsohhnuceosghjohhrnhdrgidrlhgrrhhsshhonhesthgvlhhirgdrtghomheqnecuggftrfgrthhtvghrnhepjeeiieefueelffetvdfhudfftddvvdetgeeuiedugfegvddvuddvtdfguddtheetnecuffhomhgrihhnpegvgihtvghrnhgrlhhsrdhiohenucfkphepvddufedrieegrddvgeehrdduvdeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrdejrdduudgnpdhinhgvthepvddufedrieegrddvgeehrdduvdeipdhmrghilhhfrhhomhepuhekleeltdeigedujeesphhnvgdrthgvlhhirgdrtghomhdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvghtpdhrtghpthhtohepnhhikhhithgrrdhpphhvsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhhofigrnhdrtgholhhlihhnshesghhmrghilhdrtghomh
X-RazorGate-Vade-Verdict: clean 0
X-RazorGate-Vade-Classification: clean
Received: from [192.168.7.11] (213.64.245.126) by ts201-smtpout71.ddc.teliasonera.net (5.8.716) (authenticated as u89906417)
        id 612E0510004466D1; Mon, 6 Sep 2021 19:36:44 +0200
To: Nikita Popov <nikita.ppv@gmail.com>,
 Rowan Collins <rowan.collins@gmail.com>
References: <CAF+90c-Xze=9A66hfDggan-JrebJDNvS1LdU45_Lreg+LXGhuw@mail.gmail.com>
Reply-To: =?UTF-8?Q?Bj=c3=b6rn_Larsson?= <bjorn.x.larsson@telia.com>
Cc: PHP internals <internals@lists.php.net>
Message-ID: <672fd392-9be9-5a4a-41bf-97acce73de8f@telia.com>
Date: Mon, 6 Sep 2021 19:36:43 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <CAF+90c-Xze=9A66hfDggan-JrebJDNvS1LdU45_Lreg+LXGhuw@mail.gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-GB
Content-Transfer-Encoding: 8bit
Subject: Re: Alias stdClass to DynamicObject?
From: internals@lists.php.net ("Björn Larsson via internals")

Den 2021-09-06 kl. 17:28, skrev Nikita Popov:
> Hi internals,
> 
> In the thread for deprecation of dynamic properties, Rowan suggested that
> we alias "stdClass" to "DynamicObject" in
> https://externals.io/message/115800#115802. I wanted to split this
> discussion off into a separate thread, as this can be decided independently.
> 
> The rationale for this is that "stdClass" is something of a misnomer: The
> name makes it sound like this is a common base class, as used in a number
> of other languages. However, PHP does not have a common base class. The
> only way in which "stdClass" is "standard" is that it is the return type of
> casting an array to (object).
> 
> The actual role of stdClass is to serve as a container for dynamic
> properties, thus the suggested DynamicObject name.
> 
> What do people think about adding such an alias? Is this worthwhile?
> 
> Regards,
> Nikita
> 

Well, we have legacy code where stdClass is quite prevalent and the code
works just fine!

In case of deprecation of stdClass I would like to point out that the
benefit of replacing "new stdClass" with "new DynamicObject" in our
existing code is absolutely zero. However, using DynamicObject in new
code has a benefit since the intent is clearer.

I think one also should take into account how much is stdClass described
in documentation and books. Reason is that deprecation is not just about
how it affects code. I'm a bit of a book worm so I'll check up on how
the usage of stdClass is described in some PHP books.

If deprecation of stdClass is on the table I think it should target the
last 8.x or 9.0 zero release.

r//Björn L