Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93517 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6006 invoked from network); 25 May 2016 17:10:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 May 2016 17:10:28 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.52 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.220.52 mail-pa0-f52.google.com Received: from [209.85.220.52] ([209.85.220.52:33367] helo=mail-pa0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/25-14311-38CD5475 for ; Wed, 25 May 2016 13:10:27 -0400 Received: by mail-pa0-f52.google.com with SMTP id xk12so19465493pac.0 for ; Wed, 25 May 2016 10:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=A46TkMBPT1SXfy37oeC19zX1QPAVLfRRa3QmjIvLIoY=; b=K1oHjq1ya4HJBmWTZVS+8o5I7PCe2FQgSTIBzDZUO+MSvCMP/JgnCJGoP3VnQr4w6s ib1Zgcv2v22Krq+JiTwjaGbmLMJpK7p1M+3J1FsyVS4caH4xuf+Ijq9VE3lN403sVXjv DnjE4xrE70sf+qLbBvZ7A3yHNu1e5HbUBHtjekz2SnUx6V+Sq2c7rpxOlZC4v3CfaVPx 3jMpNdaqLLMcZXc/GaJpPStpFdUnL1QC32++b7tSHTHO8Msbxa0aa6QzUL3+URHGxuPo gZ7JCi1ZfTMee4YSvPdtI+dK3Q0LA9grMp5BQ5b2yW8CP5t4+ouPyKtDc4zhZOh7Oe5w efPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=A46TkMBPT1SXfy37oeC19zX1QPAVLfRRa3QmjIvLIoY=; b=ANZTRd/cpifLdc5roTT3VHJms+QrdWsk1tDHCOZXddBRZlKtewmhgno7OUbCryZSsf VDse+/NMUFjWfQEVvQWoVK+JOWdw0snMC7RflTyZwz8hK5qYQR8AsoytQxbCBSa1P3Mc G5XB+VizN538YsC42MWpmJWuimvH2vxxgaJDcdPaKckesRiwm9XXKKF8xL3nmNa6Nsvx YSiFZdU0DIjS0KHSQhx+uIgTutyz+lrz/7cFLdmRq79JEhsusEuL+XoYfZJbWL+gd19W Q2f2JY3B91F7qdzzB94DtZ/vFxdys/UjwBAEq+zDOeHK/kMjw8XLKGf8ZVvye3OztAuU kbOg== X-Gm-Message-State: ALyK8tJCaU/fFok4NDdGgDtQcn2tAfzCHfKiITXzOMjaEfTE63K+aP9JVkvqqnbLc8QWRw== X-Received: by 10.66.185.68 with SMTP id fa4mr7341916pac.41.1464196224053; Wed, 25 May 2016 10:10:24 -0700 (PDT) Received: from ?IPv6:2602:304:cdc2:e5f0:b177:4298:e7de:af5a? ([2602:304:cdc2:e5f0:b177:4298:e7de:af5a]) by smtp.gmail.com with ESMTPSA id ih15sm11021306pab.38.2016.05.25.10.10.21 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 May 2016 10:10:22 -0700 (PDT) To: Andrea Faulds , internals@lists.php.net References: <80.72.63510.DAFA5475@pb1.pair.com> <68fd73e7-ad19-3758-7b7a-6013cc26385f@gmail.com> Message-ID: Date: Wed, 25 May 2016 10:10:11 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > It'd be a BC break if we changed untyped properties' behaviour, yeah. We It's not that simple. Lots of code operates on sets of properties or dynamic properties, not one specific property. That code now assumes properties default to null. If there's another default, then all that code will have to be changed in case somebody somewhere defines a typed property. The impact is that as soon as one typed property appears anywhere in the code, pretty much all the code that deals with properties (within affected property set) has to be changed to accommodate it. Unlike parameters, which are local to function, properties are important across big chunks of the code. > wouldn't be inventing a new null, though, we'd be leaving the property > undefined until it's initialised, which we already have support for > (properties, and indeed all variables can be unset()). unset() now causes the property to disappear - as if it were never defined. But you probably expect something different? So what isset() would return for such property? What would is_null() return? What would gettype() return? >>> A simple example might be a Lisp-style linked list cell: >>> >>> class LinkedList >>> { >>> public int $head; >>> public ?LinkedList $tail; >>> } >>> >>> In a properly initialised LinkedList, the $head is some value, and the >>> $tail is either another linked list (the remainder of the list), or null >>> (we're at the end of the list). >> >> This is a very weird list, as it can't be empty. > > The empty list is represented by null in this arrangement. null and empty list are very different thing. null is nothing, empty list is an object of type LinkedList which just happens to not contain any values. You can call methods on empty list - e.g. add elements to it or check if it's empty or compare or concatenate with other list, etc. - but you can't do it on null. Making assumption that null and an empty container is the same is not a good idea usually. -- Stas Malyshev smalyshev@gmail.com