Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93453 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99497 invoked from network); 23 May 2016 19:19:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 May 2016 19:19:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=inefedor@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=inefedor@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: inefedor@gmail.com X-Host-Fingerprint: 209.85.215.48 mail-lf0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:32881] helo=mail-lf0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C6/5B-14293-BB753475 for ; Mon, 23 May 2016 15:19:24 -0400 Received: by mail-lf0-f48.google.com with SMTP id e131so27879535lfb.0 for ; Mon, 23 May 2016 12:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=WgtaUoajyjluDi9bBeNhkgNMomHr5Ezc8DXBVj0Az6Q=; b=Xl4UEDZumwGv6OdbPJY7TofqdZpQplQa8UDoYAbH6BFzCNDlnseWxWGnkZxeVBlSzr u+Sbulqm2j5TcsNVxBsUCC2g1O8nUUrLkrAA6slGIPbzTj4u/tsLrhC/U3qKedJpmqhP git4SI3Ech3eQGeNh4yjG4CeckTl3ThheDO2sSAKbps/AyRnpmrAlv2ZBGG/YZXhf9p7 B/bkQVIkFVCqxp4kDC6hmFUqAipJObLBYEBgZ/F41tBAScmoS31yuutZlvpJixn55rUp LkFXGtNVg62tWt970wLY1juOCVUGWuU2IvuHvmQn39PQvbn5weOzJmUEhtMuldylee34 8HiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=WgtaUoajyjluDi9bBeNhkgNMomHr5Ezc8DXBVj0Az6Q=; b=iz4Yp0KLomh1hIe+dWLDlv/7+O56L2Qdub66djO9jxmKaueb+QM13/H+bO6cx8Hz6K 5vxhuNIjdKzUe+k5oktAp4zBgRwv8unsXDnTyFS9W/sU1uH5WTFJQC52uRG5j6SJ/zjE xO+zcQRfRVaqZl86odJNx9oKIN9c5Qs2M9jv++sZ184Cs+OxF0ItP+NUv/u0EVQzb5Bn gyVYH+HnRfrG4hmYcU3cNfnWOf8wvbLA4EpOLjrVACOUHcSg/GmmrqXN6m+Ufh0ZAA5O R6PBIgLvGAG847Kt7mU2AunMQonudXjUvQH8/mmct8XPgRMcBNtp0N33ONZugM5mMGJW OlMg== X-Gm-Message-State: AOPr4FVosXNKjKdNSoXBL9H9XEBXjG1quXzukZLAHwHffCO7Qx0nvRT3Reu79m+QXa/DYA== X-Received: by 10.25.40.144 with SMTP id o138mr6773904lfo.160.1464031160813; Mon, 23 May 2016 12:19:20 -0700 (PDT) Received: from [192.168.88.197] (broadband-95-84-234-130.nationalcablenetworks.ru. [95.84.234.130]) by smtp.gmail.com with ESMTPSA id n13sm6198870lfb.28.2016.05.23.12.19.19 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 May 2016 12:19:19 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) X-Mailer: iPhone Mail (13E238) In-Reply-To: Date: Mon, 23 May 2016 22:19:18 +0300 Cc: "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <5388A629-AA48-4CB8-8106-90BAA9B9F227@gmail.com> References: To: Levi Morrison Subject: Re: [PHP-DEV] [RFC] [Vote] Callable types (now: Callable prototypes) From: inefedor@gmail.com (Nikita Nefedov) > On 23 May 2016, at 19:31, Levi Morrison wrote: >=20 >> On Mon, May 23, 2016 at 8:27 AM, Nikita Nefedov wrot= e: >> Evening internals, >>=20 >> With this message I'd like to go to vote >> with the Callable prototypes RFC targeted at 7.1: >> https://wiki.php.net/rfc/callable-types >>=20 >> We've renamed it (previously was "Callable types") as RFC names often >> dictate how users will call the feature and I want it to be more >> accurate/descriptive. >>=20 >> Also the reflection part was added although I'm short on time currently, >> so implementation for that will be ready later. (speaking of implementati= on, >> it also currently doesn't use cache_slots - also something I'll add when >> I have a little bit of time) >>=20 >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >=20 > A quick question before I vote: do callable prototypes allow for > default parameters in the signature? There are examples for having a > function passed that has a default parameters but I am not seeing it > anywhere in the callable prototype definition so I thought I'd ask. Hey Levi, Although it could be done as a later RFC, my stance on it is that default va= lues don't belong to the prototype of the function. Why I think that callable typehint doesn't need default values for params is= : you either need this parameter to exist and even if there are cases where y= ou'd like to pass some kind of 'default' value implicitly, you as a caller s= houldn't impose on the callee responsibility to have this same value in his d= efinition and instead just pass your argument explicitly... or if you don't n= eed this parameter (as in you don't plan to pass anything explicitly) then y= ou should just ask for a function without this parameter as there is clearly= no need for it at all. Moreover I would argue interfaces have it wrong here too: the fact that defa= ult values are part of an interface yet their invariance is not enforced, yi= elds an interesting sort of possible LSP violation. F.e. if we have an inter= face Logger (a completely unreal example but it shows what can go wrong) wit= h function 'log($message, $level =3D LOG_DEBUG);' and a funny implementation= that decided to change default value of $level to LOG_ALERT, then all calle= rs of Logger#log who relied on the fact that level if not specified, will be= LOG_DEBUG, who also happen to get the funny implementation of Logger will p= roduce unneeded noise in the logs with their alert level messages which were= intended to be debug messages :(=