Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116004 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72899 invoked from network); 8 Sep 2021 07:56:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Sep 2021 07:56:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A7DD418053B for ; Wed, 8 Sep 2021 01:33:51 -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,FREEMAIL_FROM,NICE_REPLY_A, 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-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 ; Wed, 8 Sep 2021 01:33:51 -0700 (PDT) Received: by mail-wr1-f49.google.com with SMTP id g16so2027288wrb.3 for ; Wed, 08 Sep 2021 01:33:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=N44G5dExO7k7tIkpu7CLOOdWZok+OBKg/1Vin8R5nF8=; b=iI5+qZNRdEu1b5LcIdNv+Ng5MD3iY6XXakCQjg4dhLQM3O0DMzayFSBxa3LGelX2u+ 9UOU04RZ14MGHSjWf/FPX8BQcgMbCwne/RP+XxuaFmkYvljiNnJzZ26SVEjvDKaOoxQc M9c8QfpCxkNotxpw0x13rGOB0t/ydidMSL8/76KqkDiAPNcrp5RAO2TEDYILlAW9iGg0 5kKTgAWW3uaIsBGb9+pVCMkXYqXDe0vlGQ5irtIvufU9fWdhyAgCO81hITzPmuTM6R9f hBKbA4rxryneo4sB9JW7h9WhgV6Kl6yaJffcK9bsGQ6g4D1WAk/tJyOKBnzT9hzVXnjl oDIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=N44G5dExO7k7tIkpu7CLOOdWZok+OBKg/1Vin8R5nF8=; b=vDWOVtP3xG2bU/4Zf598Ixa2wa6qXb0JeFDqlb7VWYorYoWL0A1fK/PchCRKUWMhmF 7k6osYZxy4MJlSQR+wun48KpGkxNFaiM+ETL7pvkV7LyPDSLlICQMXEAQ0v/Vl65xNiJ cnLTzJ+ykm0YwCrol9M8RZGzv+wZLqFDJnszHoo2pUpI0GSxqz2FdgcsH2vJnw96Oxce taCgnaiA4Klw9BwsSkEA/KZ4SxgqWReuzzVJAN6zxUIX3dAX3Bj8uf8HUJGDvEnqZVV+ KzJEkfgmjpdZxkqcf67vxJ06UVljKjmZlDEp25QrWScar+MMqK7wommovONyhwoy4Noa d/FA== X-Gm-Message-State: AOAM530rA22AGOTkugiK4Kkx8BLdpZ4RdqTcrDpQXbaTTbTpJ7E78rDg BOH8QxBipy646ZGmThU1JX2XG2nV0Rc= X-Google-Smtp-Source: ABdhPJxc6W209/W8IJQRbIj2iz+Fnmh5sBEbi//u4fXclvD/ZZEXLco8+rLJcvfNb9SypmUFNmhhgw== X-Received: by 2002:a5d:6210:: with SMTP id y16mr2569849wru.290.1631090028705; Wed, 08 Sep 2021 01:33:48 -0700 (PDT) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id g1sm1673909wmk.2.2021.09.08.01.33.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Sep 2021 01:33:48 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <3dfa71bf-b600-bb03-d69d-1c6e3ef90609@gmail.com> Date: Wed, 8 Sep 2021 09:33:47 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [PHP-DEV] Alias stdClass to DynamicObject? From: rowan.collins@gmail.com (Rowan Tommins) On 07/09/2021 17:15, Marc Bennewitz wrote: > > * It's a class -> Why do we suffix it with "Object"? Classes are generally named to make sense when you have an instance: a class called "HttpRequest" is not saying that the *class* is a request, but that every *instance* is one, as in "$myRequest = new HttpRequest;" Similarly, "DynamicObject" is not saying that the *class* is an object (or dynamic, for that matter), but that every instance is: "$myObject = new DynamicObject;" > * Yes it's about dynamic properties - but is this the user goal to > have dynamic properties or is it an implementation detail to get > something else (map/dict)? I think a lot of uses of stdClass are precisely where people feel a map or dictionary *isn't* appropriate, and that's why they don't want to use an array: for instance, decoding a JSON string, or a database result row. The values aren't all of the same type, and you would never want to apply the same operation to all of them; you will probably initialise them once, and then access them by name, but don't have the facility to declare them up front. Regards, -- Rowan Tommins [IMSoP]