Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64537 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78210 invoked from network); 5 Jan 2013 00:48:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2013 00:48:18 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.43 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.215.43 mail-la0-f43.google.com Received: from [209.85.215.43] ([209.85.215.43:62082] helo=mail-la0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/E5-38386-15877E05 for ; Fri, 04 Jan 2013 19:48:18 -0500 Received: by mail-la0-f43.google.com with SMTP id eg20so10495691lab.2 for ; Fri, 04 Jan 2013 16:48:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=F5OV3Ti9u5LOg669VZZMg/EXW+ibEI7dG69q0qKQLdw=; b=wE6YysmKpIjd61TR081KuTGzjF/0ppSq/y2H+W6JM/hlwg2RMNHZi9vLVmNXrcegRj yOP53/7Z3mqWVXJHMUmrDodsO9Ih153KRd7T9dIFb9ekgd40/ADWXSh17Qe9JNpHjPZu vVxkzCgnPJWt1fAyKHRYrxnfysV6Nd1qcHnGXw3L3gpZ9/+6eAhhqaGRP4vHF5uwYDH3 aFh+XSK1lF95GzpePexmNhzOAYymD+qzHZj/0e2cgWHPELVq/mj5JZN6fjKUHo8ynerX Ip9T6dAxcFSssjCy1POsXZHN7meDSTLuv55CLxC3CCIYlR1py8aho5to2wyF6igT8noW JRBg== MIME-Version: 1.0 Received: by 10.152.105.203 with SMTP id go11mr51373394lab.53.1357346894683; Fri, 04 Jan 2013 16:48:14 -0800 (PST) Received: by 10.112.4.168 with HTTP; Fri, 4 Jan 2013 16:48:14 -0800 (PST) In-Reply-To: <19D80B01-BE88-4119-8A15-B631A96060E5@mrclay.org> References: <19D80B01-BE88-4119-8A15-B631A96060E5@mrclay.org> Date: Sat, 5 Jan 2013 01:48:14 +0100 Message-ID: To: Steve Clay Cc: PHP internals Content-Type: multipart/alternative; boundary=f46d04083e337e9e4704d27ff33d Subject: Re: [PHP-DEV] [RFC] Alternative typehinting syntax for accessors From: nikita.ppv@gmail.com (Nikita Popov) --f46d04083e337e9e4704d27ff33d Content-Type: text/plain; charset=ISO-8859-1 On Sat, Jan 5, 2013 at 12:31 AM, Steve Clay wrote: > Would the following two be exactly functionally equivalent? > > public Foo $foo; > > public $foo { > get; > set(Foo $value) { $this->foo = $value; } > } > > We should also consider how an author would allow type-hinted properties > to accept NULL as a new value, in both proposals. > I think that's a very interesting question, thanks for bringing it up. I think a good approach here would be the same one used for function argument typehints, i.e. allow NULL when NULL is specified as the default value. So `public DateTime $date;` would not allow an explicit NULL assignment, whereas `public DateTime $date = NULL;` would. Nikita --f46d04083e337e9e4704d27ff33d--