Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103257 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88209 invoked from network); 25 Sep 2018 16:32:42 -0000 Received: from unknown (HELO mail-it1-f171.google.com) (209.85.166.171) by pb1.pair.com with SMTP; 25 Sep 2018 16:32:42 -0000 Received: by mail-it1-f171.google.com with SMTP id m9-v6so1530111ita.2 for ; Tue, 25 Sep 2018 05:40:34 -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=UV+8cDRlHJ/ZUOmEcQUlCqFoYmd/b9Ft/+RMr4KHQh4=; b=vLXX02G9cbfNsptc59R8d46+sQTxrXyRYABuawuMFwQ4ccJ1USiMjUSV4fhQ9mB67o TTdgtkK9y932AGc3gDcy0NO3afQxOcq1cAoayfYPJsDRf4zVdVe747c+LQDZKlY0HLfU Q0INdaD97UsVKy1+0eoHLpa3QJDrt786vStCrD95sdtNo9JorLOIfNTZ/PpENmZgiii9 +IFFNOup39NISSkyEGCGPDy3+hkq8lIWXhQExLbnkXas7LGvdfNlo8FqA6NBViyvZlkA QFnMw2ssS7L2w4SiBihClVwoRveMglIfORPDNXZ0zxvnC7RiVHu6XmvkoYxSta3hlZZi +yKw== 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=UV+8cDRlHJ/ZUOmEcQUlCqFoYmd/b9Ft/+RMr4KHQh4=; b=t31bauc+qSvz84b1DE4e6rjFBt+0pi9bSHppaXf9gBVOdeF3mkrBU8QugnXyLlxL6v EWixVwAKO6//GeoUBAWwoUC6RBi9aEQkXprlKDY5k0HevTfI0YKqyZEZQ1f+e/vPTGJM d28cLywu3mBZXIivfnVbL/31vEtfYcpu2rvpwfT/97QWAI2ATvEENMp6dHuSWEL6MQvr 6sN5w/w6cKmOojWIsEHSCRUfK/rxyR6FP3cT4FQ1C267xl7HM72sW1OGGs7OUiG9uuDy 7dHcCtJLlYQ6/Rkdjzq/xOttw73I1X3/0NZlAhjOGNcpF7a799T6b8D/pjhf87Luz+XH z2yg== X-Gm-Message-State: ABuFfojwziewtneCoT5Mjld8d4U4WnwY3MrTPRg5NsILPvbeyCAgcbIs 4m7pNvdab4OO49OVu07wH9EG4ULuYEUg0Ltiqis= X-Google-Smtp-Source: ACcGV61O3A4gh206lMtWMirqPlFq0fCgeeGjR6jzPE2wKcGJ0upEGnl0spvXCgiyOL4J8gzZ0aVTqesguwdd//Nk024= X-Received: by 2002:a24:6584:: with SMTP id u126-v6mr517571itb.130.1537879233837; Tue, 25 Sep 2018 05:40:33 -0700 (PDT) MIME-Version: 1.0 References: <1681263.Ri4PIu1jiQ@vulcan> <1476841B-EEBA-4513-8DD8-7ACE1F662372@gmail.com> <95a7902d-8451-06ee-debf-6f03c4fd7190@gmail.com> In-Reply-To: Date: Tue, 25 Sep 2018 13:40:21 +0100 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000070c3ae0576b169d7" Subject: Re: [PHP-DEV] [RFC] [VOTE] Typed properties v2 From: rowan.collins@gmail.com (Rowan Collins) --00000000000070c3ae0576b169d7 Content-Type: text/plain; charset="UTF-8" On Sun, 23 Sep 2018 at 22:48, Nikita Popov wrote: > > There might be a compromise here, which is to only perform a ctor > initialization check and forbid explicit unset()s if the class does not use > property accessors (i.e. does not define __get). This allows the lazy > initialization pattern but is stricter for everything else. (Possibly __get > in subclasses would also count.) > Hm, that's an interesting suggestion, but I think it might get a bit complicated and confusing. There's also the paradoxical fact that you can implement __get() to make your classes *stricter*: public function __get($prop) { throw new \LogicException("Attempt to access non-existent property $prop"); } I think I'd prefer to leave the unset() behaviour in, and then: a) come up with a better mechanism for lazy-initialisation and b) come up with a way for classes to opt out of having *any* dynamic property manipulation (no unset, no reads or writes to undeclared properties) I might start a thread to bikeshed an appropriate mechanism for (b) because it's something I've wanted for a long time. Regards, -- Rowan Collins [IMSoP] --00000000000070c3ae0576b169d7--