Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108572 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 35294 invoked from network); 14 Feb 2020 15:16:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Feb 2020 15:16:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 659831804DA for ; Fri, 14 Feb 2020 05:30:49 -0800 (PST) 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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (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 ; Fri, 14 Feb 2020 05:30:48 -0800 (PST) Received: by mail-il1-f177.google.com with SMTP id b15so8076244iln.3 for ; Fri, 14 Feb 2020 05:30:48 -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=oa/1stP8ZZ4unAZH87M8DzRE0/d4ibYBqlXj4BAn3Oc=; b=KrXYxhoWZFVQbP6IGPRrS9+di24+sbNz1Gdk/Sv5xV3rcQbtMLwOXAJ1JqrXSVStAx IU1duMqDRij/1nySHzbgyQJ3dMdgJg8k/JZOKY6rOLAeBi+CYCnzovY+e0BbuP5fA3ir q7tYpIY4ujf7E73bxYwLKRamyp+Q141N2r4dyw8J9frhrmGq6d+g+KRSTPXMjsFW8GPy yLeHQaURI+FbihYKWw79WRl0pTYbPNdlKBsnTWyqfqmtDDhJ13J+mpPP3ZNRE96E09Zh s4l/IeaOhs0Ep27cuaMwStD5FwRsaUVGecKYfuDip41D0NyWvYskraAbXohk5Nl5qJzu FPkQ== 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=oa/1stP8ZZ4unAZH87M8DzRE0/d4ibYBqlXj4BAn3Oc=; b=Zzeo0XsP+h0XVyk2QUNEd9e/Oxyx75SrmQ0OFnqZiQ/UHQc0WuMd1BrF2nRqZ38AGn i9gRDMg0LhSiau78ssntcV3396IvH2R9cmdzxnXWP6PRT5Dw9AWB8pveb3BrssonOstq nNXrXpzf86eV1DSC+wiEScxBTi0ECpMPFkEt9AMUenTonYOXV1zsF1mUeJOZXsghtGOr zhGHjVQ20pSw4WqAI+7s/ZmavQAK7o4QK6VrXu6N1BC+4bv7aeW4KY1gcROD4+j1yvBb GqDv5/Zc+8C+u67plr4rkXpBCSnEnjRieO5nATUAjZdkt7tyRayeR/TNBUpz3yQTLIN7 RwNw== X-Gm-Message-State: APjAAAX6+m7f8bYTfgLYmjkFYHxzcQROdbQVK/fj2+FYECMqEtNoKJFF yDzP7m8zq8r2mbwZVEMsXOGGV9mHP/8IB5m+6zc= X-Google-Smtp-Source: APXvYqx/gvnfD99LTEQl/7Gc6w/WlxZtLQWuK8g9wfjL9yqk5JGLx2rxoDkIoDV6x/1F9YmnTEVfKYevTd9Pcb1/IDM= X-Received: by 2002:a92:3a4b:: with SMTP id h72mr3027665ila.292.1581687046760; Fri, 14 Feb 2020 05:30:46 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 14 Feb 2020 14:30:35 +0100 Message-ID: To: =?UTF-8?B?TcOhdMOpIEtvY3Npcw==?= Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000916ee9059e89361f" Subject: Re: [PHP-DEV] [RFC] [PROPOSAL] Immutable/final/readonly properties From: ocramius@gmail.com (Marco Pivetta) --000000000000916ee9059e89361f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Feb 14, 2020 at 2:23 PM M=C3=A1t=C3=A9 Kocsis wrote: > > So far, my biggest question (apart from the name) have been how non-typed > properties should behave: as they are implicitly initialized to null if > they don't have an explicit default value (while typed properties remain > uninitialized), further modifications would be impossible to do on them - > which would make non-typed final properties almost useless. Nikita > suggested to just avoid their initialization, but I'd be curious about > other ideas as well. > Considering that PHP 8 will have union types, adding un-typed properties support seems like a waste of time. If somebody really wants a `mixed` property to be immutable, they could write `private immutable null|bool|int|float|string|array|object $property;`. That would make implementation straightforward, since you'd expect `immutable` to be before a type declaration (can be done in the parser, right?). Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --000000000000916ee9059e89361f--