Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115999 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51221 invoked from network); 8 Sep 2021 02:25:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Sep 2021 02:25:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9E928180504 for ; Tue, 7 Sep 2021 20:03:01 -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,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-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (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 ; Tue, 7 Sep 2021 20:03:00 -0700 (PDT) Received: by mail-yb1-f175.google.com with SMTP id v10so1255905ybm.5 for ; Tue, 07 Sep 2021 20:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B34AGfa0xO2v2kmSWVvQxHrwUMCJidr5iCKsF4IEQLg=; b=WRbPEWECYFSevU2WaztL30AQDMGmbq3YJcxxHUliqBeg4hHN/nDQGo7szcRrAHHvXk vveDnFqMhEvzuLiflHhXyhY1umrOh2vyCRITJGB7Ze7vCO4eZbVCa1qko+vFUQ7g6qB3 Ase7SR4osP5zZq/ajyWknx920C7CcN6JW9hMU= 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=B34AGfa0xO2v2kmSWVvQxHrwUMCJidr5iCKsF4IEQLg=; b=tmD6zRz52pTY4pyfF5mzRRdPKAODXqawgKmj+kUkzlyX1Im6crq5j3BjYSuf01izZB /rdYw2svMKfuxA7s6rcHiVbwleCrD3qMwRwVhgn+s5wK5knxCiWYgbDqm7ueOCeRYxB8 zPx/npBOPAoWkaw0CL3mNkoLC5HCEa+TkBMgq+eh2pN1BFK9J52oQL+fnj1UBXxAGrbO n4c2+MgfdadnQy6Nu9oMPDJdGX7kmoJrGjj2xaTR2Atv5DA5V5DmMywV6Br8B9tQY2ML zvM3ElsKIR6FkTcOzo1eZx/djGt1tawpliPd0DkThUG7Xcu4yE0QVEZOhq8hD7Rw2SYl cbMA== X-Gm-Message-State: AOAM531FTQIuU7mOXr2xLKONHu+BSBtaFW6T9HjqdryyGE2pMZLHBYCk F9tvz29wRAAIQZ2cmRim+jDa2s8lXZz0fHZulT45Jw== X-Google-Smtp-Source: ABdhPJzToTBu7WTIxr6fNgoFHM06MMxMJEwQjNMK/T9YIGGs/UFobhcWZLMG3P7bmsIx/1Yyuao2GAv5yfREk9UDVuI= X-Received: by 2002:a25:1b85:: with SMTP id b127mr2073061ybb.219.1631070163475; Tue, 07 Sep 2021 20:02:43 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: Levi Morrison Date: Tue, 7 Sep 2021 21:02:32 -0600 Message-ID: To: Nikita Popov Cc: PHP internals , Rowan Collins Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Alias stdClass to DynamicObject? From: internals@lists.php.net ("Levi Morrison via internals") On Mon, Sep 6, 2021 at 9:29 AM Nikita Popov wrote: > > 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 If the alias goes to vote as the name DynamicObject, then I will likely abstain. I don't care. If it goes to vote under some other name, perhaps "map", or "dict", then I would likely oppose it. I would like to keep those names available for more useful features. There are multiple feature that would like these names: 1. Hacklang-style dict, which is a value-based dictionary type. Importantly, this is copy-on-write like an array; it does not have object semantics. 2. In the event we ever add generics, it would be nice to have these names available for interfaces. I don't think an alias and replacement name for stdClass is important enough to use these names.