Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80524 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39749 invoked from network); 15 Jan 2015 08:49:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2015 08:49:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=pajousek@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pajousek@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.53 as permitted sender) X-PHP-List-Original-Sender: pajousek@gmail.com X-Host-Fingerprint: 209.85.216.53 mail-qa0-f53.google.com Received: from [209.85.216.53] ([209.85.216.53:61628] helo=mail-qa0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BE/E3-14306-90F77B45 for ; Thu, 15 Jan 2015 03:49:14 -0500 Received: by mail-qa0-f53.google.com with SMTP id n4so10187552qaq.12 for ; Thu, 15 Jan 2015 00:49:10 -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=gfZdHv1ifsl+7Hzlh2FUsL8YfYfZ6JHetkaeFCjIOYY=; b=ZFMvN60roGDTGFuIkwPoVvU+wXUHJkeDBFpjRy4yoPKxJh4Dxse/6Twhrtec7XJ8qj ZKTbdF4wcijjN3Z9hRBF30OrCEsHegpcQckOaCsyVR2rTDO/F0wrkYVAXmgxYn4vJ7Md K3fnRBIg5P+vKSvpmAywkBb+s6O92++vChrLQFAjvTGG8XrPmNi9XdQtIPOJhHqEQDZe NLlJUyPG6nXs6qu7F8eyI6t2nTeG3AKCsXSFYtl9X6v9EwJ8rYAlhUAnTSmXWrGeYoT5 0D//OVP8E/CRdrGljy+79+onrvm1OtX+OCux4h90zLQ11Oryf0MbYEM04wZjFe7lPiis QNPg== MIME-Version: 1.0 X-Received: by 10.229.125.133 with SMTP id y5mr14325080qcr.17.1421311750302; Thu, 15 Jan 2015 00:49:10 -0800 (PST) Received: by 10.96.55.138 with HTTP; Thu, 15 Jan 2015 00:49:10 -0800 (PST) In-Reply-To: <54B77A7C.406@lsces.co.uk> References: <8DCD1B72-C81D-499E-B455-E4A042CD76E6@ajf.me> <4E2073DE-0951-498C-97BB-DDAC094F11FA@ajf.me> <9a033dd1f223f854e760924d118ab812@mail.gmail.com> <2ae0164cb9b9bf1c974d7a3c60af0466@mail.gmail.com> <54B77A7C.406@lsces.co.uk> Date: Thu, 15 Jan 2015 09:49:10 +0100 Message-ID: To: Lester Caine Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: pajousek@gmail.com (=?UTF-8?Q?Pavel_Kou=C5=99il?=) On Thu, Jan 15, 2015 at 9:29 AM, Lester Caine wrote: > > One of the nice features of PHP when I started using it all those years > ago was that I did not have to create separate functions different types > did exist in the source data. int/float/num/double and others all needed > separate handling in c/c++, and one could not easily add a different > 'type' of data. > If you have a function which requires a "double" in C# (a strongly typed language), you can safely pass int to the function and it will work, because you are not narrowing the possible values. So making the PHP accept only the argument if its type is exactly the same as the parameter (paraphrased from RFC for the strict version of type hints) seems like a step in a wrong direction. If I'm not mistaken, Java behaves the same way. How exactly does it work in C++ and C? I haven't used C in years, so I'm a little bit rusty on this detail. Pavel Kouril