Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103202 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21612 invoked from network); 20 Sep 2018 15:44:20 -0000 Received: from unknown (HELO mail-io1-f42.google.com) (209.85.166.42) by pb1.pair.com with SMTP; 20 Sep 2018 15:44:20 -0000 Received: by mail-io1-f42.google.com with SMTP id y3-v6so7133369ioc.5 for ; Thu, 20 Sep 2018 04:50:57 -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; bh=Zr1KLtBhWRT7qT40TlQzamzxmgy9KHqRWhDxAmYKVZc=; b=d/1jLX8uXhh+cWY8ifE/o9QQxeX13US3XyyUF6vyVhdhdo3sXiY6VbZl3wrlE5FaVn aKQ7EWaDc0moaWs4veXV8PjqzwQAYdQyeWL+8ZfmH3i8w17zJscq29LdIR80JJmrXaHF mVb9wntgjD9I7Xg/VeOcXi9ZY+raPcYUJH7UlrwAJHSc97YrSPD1rNR4SbO5cyuWTOQD /NXLl643V6e1WTgD2O+HPyI9i/Bzk5XWdmrOnPfIw6GpNBY5Bfl45u5mkVeD5S8SrboJ wwREZqBt7Ebpj8kIPEvPyQlWkRrSYq+ZfMDlXx6xlHrhuzA0cL6EDirfOJxf7rBKQP1r xVfQ== 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; bh=Zr1KLtBhWRT7qT40TlQzamzxmgy9KHqRWhDxAmYKVZc=; b=owaxdt09bGQP94Svj57jPPl0kgdjIwY+pXHHxEyzzjHTbQTmLskdzwWVz+eEyJebHh r8mmL3fur9CffHUuKhjBAtZMK5HVf9/7kqhyymjWA5bX3gBdaIeCm/rUSYGeYRshXE6d a5nyF6VBafiJ/hUB2EOsTLTC6ycTjlFhseyxdwA2URQ0ZC/UBi2GJN6nMlMyl53YhWx+ s42Ev49wzUfTx42oTBLRWJHklezxwpFFfE++GKscsygwtlYZEUDaolL/48+x7fYdxkRA bEBcwM96HISMAU0Yoq70GmSb345qkZ/gsaMqSxqmryNGk+gkQslv9tdtY3u/zDj9Ekza taOQ== X-Gm-Message-State: ABuFfogo8Mz7BUgcEvQKbBGgXFGpzEd9+dINddvepY/5lReFmFI/z/Kr EYJUykVZxCFoG1y9OFcR9xKrQW4mSp2Q432rnhxn5Z+I X-Google-Smtp-Source: ACcGV62b5a0FNqose+ok9++/3EgjCOyrVoddIW4ouBuOPsvFMex6TIAEUtCcUGN9pASM965i3V87xGYwmUYZgYFJ6hc= X-Received: by 2002:a5e:df04:: with SMTP id f4-v6mr9237051ioq.235.1537444256679; Thu, 20 Sep 2018 04:50:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 20 Sep 2018 12:50:45 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000c80ecf05764c22b5" Subject: Re: [PHP-DEV] [RFC] [VOTE] Typed properties v2 From: rowan.collins@gmail.com (Rowan Collins) --000000000000c80ecf05764c22b5 Content-Type: text/plain; charset="UTF-8" On Thu, 20 Sep 2018 at 11:58, Nikita Popov wrote: > I do not consider it advisable to require a null initialization as a > "first iteration" of the proposal. Regardless of what our intention might > be, the effect of such a restriction will not be "I'm not going to type > this property for now, because non-nullable types are not supported", it's > going to be "I'll give this a nullable type even though it isn't, because > that's better than no type at all." Use of nullable types where they are > not necessary would be a disastrous outcome of this proposal. > This, ultimately, is where we disagree. To me, the "non-nullable types" this proposal provides are non-nullable in name only, and using them does little more than adding a comment saying "I promise this won't be null". Encouraging people to use them gives them a false guarantee, and allowing them to do so prevents us adding a stricter version of the feature later. > To move this discussion forward in a productive direction, we need a > concrete, detailed proposal of how enforcement of initialization should > work, while being compatible with secondary requirements. > It feels to me that many of the "secondary requirements" are actually separate problems which should be seen as pre-requisites, rather than constraints. The lazy initialization pattern seems to be a hack around lack of better support for property accessors. The mention of serializers needing custom methods of initialisation reminded me of the occasional discussion of better replacements for Serializable and JsonSerializable. And so on. Fixing that list of pre-requisites would obviously take time, which is why I wanted to buy that time by releasing initialised-only type hints first, and working towards a greater goal. However, I've probably beaten this drum long enough. I will hope to be wrong, and that making things stricter will still be possible later. Regards, -- Rowan Collins [IMSoP] --000000000000c80ecf05764c22b5--