Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104284 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 13258 invoked from network); 7 Feb 2019 15:39:48 -0000 Received: from unknown (HELO mail-it1-f179.google.com) (209.85.166.179) by pb1.pair.com with SMTP; 7 Feb 2019 15:39:48 -0000 Received: by mail-it1-f179.google.com with SMTP id z20so14232186itc.3 for ; Thu, 07 Feb 2019 04:21:25 -0800 (PST) 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=GN2QlZcNBhNa/hjgDatI7qQbD4P1jlHoXWx5Z2oYxsY=; b=hahjqD3e0iN5TC87RF8m249tM/qxIZO3rv2CoIhOpQSDEhB9+F8bc7RjPId9fp/dMV MtcUSolQVTPR7JfLnyCbwxjxXRrL51zanpShQU8GCF3c9C0lsndkODovLS0pQjDYqJzD PoxyMGyxnaKtR43z7kfIHHLMo5T1jBaWgM5ahyIjywM+wYaXS/cCO1o6gjyBDSYyWhD7 w09HUZHNLKPXazHbafr9QJ/RrVFUOwxgEQqqhUotJjXWa8+li5up48SGqtP6sUd526R0 pDs1x6oUuifc30c9VvPJr604ssITsTgQcimpe/UWeF2IdMZ85vFRuct+t2YuyJcTNaII u7jA== 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=GN2QlZcNBhNa/hjgDatI7qQbD4P1jlHoXWx5Z2oYxsY=; b=ue5WeDGTbhbgPN1ez86Kal62q4ujgw3Ow7huGGC9gr+Ln0yfgSvINJSuvjlNWzrk0y qwUjNaO30Cu4RHQyu5wM0pgo6LKOKtoMqTwmzO5C0vy8utTvaTXJDvvtSkTkTpGMIogG ocOsFVkq+jt6p0MIRZZyDgpEHkUqGD3IQ1nUvvuhescChi+x2icE31vvzecqRPPp/gbV DpTfF5tpovIFNBivPI4NJmcjjZp86DAMEBS/T/QmSMzmzv2yyKbi48LZ3zwk4DfC4bX1 F9JBpl62emOQqNxCNizARUgSWqan7uN0ShH74gWCyv1mFhTfay4FR0SU2tn9ijwx25hD PqJg== X-Gm-Message-State: AHQUAuZ9g66kJm96PZacCuAiioQDoI07NkMT3DCNlIdNtSyiPIDA3jGe CHMv2ONIB7XwOdNnBtcsmBowQ1G6pgX5pQjR9zjzHA== X-Google-Smtp-Source: AHgI3IbAw1U3eLGKV1ifPdRT8HFfjQ4eH0HwzHX3XM3ap0dyoVO7bz3hi84DZSeH0UM7BLHeZMEVa8vOHez8AQ+f5ok= X-Received: by 2002:a02:b5bd:: with SMTP id m58mr3645605jaj.113.1549542085507; Thu, 07 Feb 2019 04:21:25 -0800 (PST) MIME-Version: 1.0 References: <595b374c-bc4f-9b8a-0013-6485abbfb477@php.net> <41D0A782-E4E2-4B98-9C5D-174143DE9A76@gmail.com> In-Reply-To: Date: Thu, 7 Feb 2019 12:21:13 +0000 Message-ID: To: Benjamin Morel Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000923e0605814ce17e" Subject: Re: [PHP-DEV] Re: [RFC] [VOTE] Typed properties v2 From: rowan.collins@gmail.com (Rowan Collins) --000000000000923e0605814ce17e Content-Type: text/plain; charset="UTF-8" On Thu, 7 Feb 2019 at 11:08, Benjamin Morel wrote: > Plus, as I stated earlier, I'm confident that typed properties will give > much more credit to this approach, as we'll get an immediate Error should > we accidentally access an uninitialized property, as opposed to a null > value previously. > I don't think that solves the fundamental problem, which is that if a partial object leaks into a wider application context, *correctly written* code will misbehave. Code that previously ran safely suddenly throwing exceptions is just as likely to cause serious bugs as code receiving unexpected nulls, so all the caveats still apply. > > I can see that it would be elegant if this function existed, but it seems >> a thin justification for adding it, when the whole problem could just be >> approached a different way - e.g.add a property to the model called >> $_partialFields that stores which fields were initialised. > > > This breaks the separation of concerns: the model should only be concerned > about business logic, and not contain any persistence-related fields. > I think you've already broken encapsulation by forcing the object to be partial in the first place. Every piece of code interacting with this object needs to know that it's given a partial, and handle it appropriately, so it feels unnecessary to pretend that this is still just a dumb data object to be persisted later. Regards, -- Rowan Collins [IMSoP] --000000000000923e0605814ce17e--