Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114621 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 1541 invoked from network); 26 May 2021 16:08:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 May 2021 16:08:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 94E79180211 for ; Wed, 26 May 2021 09:20:24 -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,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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, 26 May 2021 09:20:24 -0700 (PDT) Received: by mail-lf1-f46.google.com with SMTP id e17so2843301lfb.2 for ; Wed, 26 May 2021 09:20:24 -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=UnZi35A9JJiEx+XsK4WGmUQEQT+4dbBbClAvf2jT8N4=; b=nwMP056Q5LC6fjsHJgST2EaR9ABMFgVQrrFJgvWdZ9wh1ZuG1hLXDJYcofjhzT57ei LXjKKpy11MZxwNgto43nZQ5GYSOTme2KkP1jp46HJC3FoyBH238na2B4m5G8D0oazpo6 lXG6KatL2c81zzCM7vJzR0wWk6HLHK5MbfyTO6QPBSuOc5JPw5JNAWTJ982lMnqNCo5j 1Hqt80+O3nnH1yo8Bm3HbEV1wI4DxXqnOokbOxzvRJtn2kd5mGA+wBq9DmCD2YCgFQt3 Hj317LjGVrZaIEsU8yLtRVlTy1oGJHax1S94xJhv0KaM7inQCOlUNqYVRBKeB1LAlj2v mS4w== 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=UnZi35A9JJiEx+XsK4WGmUQEQT+4dbBbClAvf2jT8N4=; b=qMGqockTO+76fRFM9cQkk7831OxsjWSJNXCyW+5KYrJ0Vp6MMP6bFr7U2fxFLHSQlJ NJ5Uf3gqjyDFAKrA9kw386DCZ6x8AMpZlTfperxqUrN9W2dAj8pjL1FXjM2Bjoe/GR4G Hdd/AyjVFoeJzk3/tnKe3awIA+SFn42Z3C0wYoI9g5SSTfDTQasU+wUliGmw/VUwqvNu O5JMxjP4QqAfJnolhA9eojKx+45AdAUmm5YNRRaW8QY7G/TWgdlahxrAxWKdq+u1Izf/ ++QXcFPu+qCu43RO7+1xKWqZLDMmIh35AcnOzNSKanIGZPAbDKwpz2ytc4htLQu18dC5 OK/Q== X-Gm-Message-State: AOAM532QYJPv1ykv7reHuD3kbGX9dIHGfKbJZR1SQsS5yt3qzUauO8qe ambr3Cb6gRd3EukfbCItm0GtKLNiDl1lRW5oxA== X-Google-Smtp-Source: ABdhPJyT80XfhDZpAj7cS4QAXkl1UiyiPoWb7HPm8w/x/xhxBtuB1R9D1FLYAGCNKdXRkwQZ4o4ie8PD3J+d9wCEdSo= X-Received: by 2002:ac2:4198:: with SMTP id z24mr2673980lfh.335.1622046022309; Wed, 26 May 2021 09:20:22 -0700 (PDT) MIME-Version: 1.0 References: <80fb5a8e-d770-49fd-45d5-ea6f4b004513@gmail.com> <2874cf7c-e55d-4100-bb01-af11a5ab6e87@www.fastmail.com> In-Reply-To: <2874cf7c-e55d-4100-bb01-af11a5ab6e87@www.fastmail.com> Date: Wed, 26 May 2021 18:20:11 +0200 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000f8195305c33e044b" Subject: Re: [PHP-DEV] Consensus Gathering: is_initialized From: guilliam.xavier@gmail.com (Guilliam Xavier) --000000000000f8195305c33e044b Content-Type: text/plain; charset="UTF-8" On Wed, May 26, 2021 at 4:09 PM Larry Garfield wrote: > On Wed, May 26, 2021, at 8:24 AM, Rowan Tommins wrote: > > On 26/05/2021 11:13, Joe Watkins wrote: > > > Hi internals, > > > > > > In response to: https://bugs.php.net/bug.php?id=78480 > > > > > > I implemented: https://github.com/php/php-src/pull/7029 > > > > > > My general feeling remains that the "uninitialized" state is an awkward > > hack that we should be working to eliminate with better constructor > > semantics. A variable that remains uninitialised after the constructor > > almost always indicates a bug in the constructor, not a state that the > > rest of the application should care about. > > I am inclined to agree here. What I don't know about is the cases noted > in the bug, such as GraphQL or other serialization cases where "null" and > "absent" are not quite the same thing. That is probably sufficiently > edge-case to not deal with directly, especially when the more verbose > alternative still exists, but that's the only reason I'd even consider > making uninitialized something other than "your constructor is bad and you > should feel bad." > I think you said the word: serialization. And especially *deserialization*, e.g. from a JSON payload into a typed DTO *without* calling the constructor (then the DTO is passed through validation, which must handle uninitialized typed properties "gracefully"). -- Guilliam Xavier --000000000000f8195305c33e044b--