Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78234 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74238 invoked from network); 22 Oct 2014 19:12:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Oct 2014 19:12:20 -0000 Authentication-Results: pb1.pair.com header.from=php@mabe.berlin; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@mabe.berlin; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mabe.berlin from 80.237.132.167 cause and error) X-PHP-List-Original-Sender: php@mabe.berlin X-Host-Fingerprint: 80.237.132.167 wp160.webpack.hosteurope.de Received: from [80.237.132.167] ([80.237.132.167:57927] helo=wp160.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/51-63701-49108445 for ; Wed, 22 Oct 2014 15:12:20 -0400 Received: from dslb-178-005-158-254.178.005.pools.vodafone-ip.de ([178.5.158.254] helo=[192.168.178.30]); authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) id 1Xh1KT-0005iV-7u; Wed, 22 Oct 2014 21:12:17 +0200 Message-ID: <5448018E.3090005@mabe.berlin> Date: Wed, 22 Oct 2014 21:12:14 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: internals@lists.php.net References: <66B7B28C-2651-4A71-AC2A-55D4C7BB3DDC@ajf.me> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;php@mabe.berlin;1414005140;87886d79; Subject: Re: [PHP-DEV] [RFC] Safe Casting Functions From: php@mabe.berlin (Marc Bennewitz) On 22.10.2014 10:37, Bob Weinand wrote: > I know we have that already discussed a lot now, but I’d like to expose my points on the return value here: > > I imagine code like (supposing that we ever will have scalar typehints): > > function acceptsInt (int $i = null) { > if ($i === null) { > $i = 2 /* default value */; > } > /* do something with $i */ > } NULL isn't a pointer for a default value - it's simply a type with no value - no more - no less. From your example: why do you accept NULL if you need a integer default value? function acceptsInt (int $i = 2) { ... Marc