Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93838 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76148 invoked from network); 6 Jun 2016 11:06:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jun 2016 11:06:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=codekestrel@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=codekestrel@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: codekestrel@googlemail.com X-Host-Fingerprint: 74.125.82.44 mail-wm0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:37019] helo=mail-wm0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/00-10476-E2955575 for ; Mon, 06 Jun 2016 07:06:23 -0400 Received: by mail-wm0-f44.google.com with SMTP id k204so21916111wmk.0 for ; Mon, 06 Jun 2016 04:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=rtAD3hZSnBQkdHEHUsOBBeHXXMABlr2NlwjgfyA1wxI=; b=OnZaAtzEVwr4fsltTmYJQxP/jnC+Is8rhKobVk9t6Qz/dWOCqXaO5TamwBB/exSdYW AyRmAGRatJfgYi6v4zUo8GB+/Dv3CkaVtY3eU6KkmQIrCcvzPrYKzFtunyCvASxZ90c2 Jv2tvI0SSv5DN+rdS5z74pb5iIn70uyuPxlK5FqrV6DmSBLjWo5oozw26E6fhPeyGJZE +Paq6m5ufMjU2Uwt/FA1K/9sK+x1g/GEjbH7TDxYle6FBEadfLFPgRjHbZrPjVMJ/nOl 0E2xWPeDx6glZDKocoENn/hWM3fnRR5Mi7mGTf5no/77hmkkHRffDCoHlqFBdJ6WiMEo gYLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=rtAD3hZSnBQkdHEHUsOBBeHXXMABlr2NlwjgfyA1wxI=; b=MRf87+zkuY93jP9zVEDf83EpPskQNdoyq/1K7EeuWKWLFlSRYCfp7gJucdznfngIlG HLPW/LqV/f/hb6fPgMXM+3r1/k4BsYjI4rNMw3ifHrLjjxXs129AI7ci11S794+/J7UI fuGRoDwzVFpBlVIJpX6+fBWInStoeiaMKrlNU5P1HOp6vznkNx7DmuTrr4UDyb7LCn+K WCGitMVQeOasnKllWxQClR0bwk4cWGEPVPf8/HzfFBWq4hHPXwyQCTlr12Q6ZCbsAPO+ YFJm9lG3IUzGbROPzcFWAx6tM6/6J8h+Qhiex0aokTElyFTeKZYLgqgPTygZhhbwHZme OVAA== X-Gm-Message-State: ALyK8tIjpSS3Mcg9oMreI9CgX36+XroMT4oiA53H/x9lx8MIRG6KViAxnpcxNoh4aNAvef8NaAlvieynGJKuxA== MIME-Version: 1.0 X-Received: by 10.28.227.11 with SMTP id a11mr6123846wmh.100.1465211179883; Mon, 06 Jun 2016 04:06:19 -0700 (PDT) Received: by 10.28.130.2 with HTTP; Mon, 6 Jun 2016 04:06:19 -0700 (PDT) Received: by 10.28.130.2 with HTTP; Mon, 6 Jun 2016 04:06:19 -0700 (PDT) In-Reply-To: <9b9b33c0-03ff-c147-5105-e4f02901ce6e@gmail.com> References: <8b3055e5-706d-ae5e-bbe6-de6ba292ca5b@gmx.de> <9b9b33c0-03ff-c147-5105-e4f02901ce6e@gmail.com> Date: Mon, 6 Jun 2016 12:06:19 +0100 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary=001a114b12e4e5e48505349a0f10 Subject: Re: [PHP-DEV] Opinion on function/method name overloading From: codekestrel@googlemail.com (Dominic Grostate) --001a114b12e4e5e48505349a0f10 Content-Type: text/plain; charset=UTF-8 In your example, the output may be: 0 3 float, int and string all share the same row on an upside down pyramid, with $bar, being dynamic, at the bottom. With regards to union types, it could work exactly like the latest Multi-Catch feature. On 6 Jun 2016 11:57 a.m., "Rowan Collins" wrote: > On 06/06/2016 11:32, Christoph Becker wrote: > >> And we would run into similar issues as with the union types with regard >> to weak typing. >> > > This is probably the biggest hurdle, IMO - regardless of the internal > implementation, you've got to define exactly how the feature would work in > the language itself. > > A quick example off the top of my head (there are many other edge cases to > cover): > > class A { > public function foo($bar) { echo 0; } > public function foo(string $bar) { echo 1; } > public function foo(int $bar) { echo 2; } > } > class B extends A { > public function foo(float $bar) { echo 3; } > } > > (new A)->foo(1.5); > (new B)->foo(1.5); > > > Regards, > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a114b12e4e5e48505349a0f10--