Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93466 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41254 invoked from network); 24 May 2016 05:58:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 May 2016 05:58:53 -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.217.169 as permitted sender) X-PHP-List-Original-Sender: inefedor@gmail.com X-Host-Fingerprint: 209.85.217.169 mail-lb0-f169.google.com Received: from [209.85.217.169] ([209.85.217.169:34778] helo=mail-lb0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/80-37212-B9DE3475 for ; Tue, 24 May 2016 01:58:52 -0400 Received: by mail-lb0-f169.google.com with SMTP id sh2so1883239lbb.1 for ; Mon, 23 May 2016 22:58:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:cc:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=bOiAt0BhZwv9x5wHUSuYIOgsHe1Z6PVCpzaHa25QEpU=; b=hl/knsg3/6B8Gk4xiOqtq+NSK1MPazt+eizXlpQZ14v4w4y1FjduGzTcbfXlL/RCQQ I6c5KO5hz+eg5Lsm/BFcAQ1cRCs4BMaKSxl1gkAEY/oYgHCGG04HFhrnykIPpZ/SGlAM pvy9ogVRribnq3IHiFbIVHrPRzTp5V2Hh5dVq2KWv0dq4mvdxApyhmBvnd2us1fzYh7d B4cLsJXSBo1Vlzn1FvVuvdL1GAjODn2zIKY7JFaE5flUkDMvJyPa2yI593Ptw13pxSz6 PBV3mtf2OIMrZrUFYBrrYjDwoGLg/sQ4PY5xHbisc+KTEFXwjSS4sXljyTsVyys6xTtw HLtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:cc:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=bOiAt0BhZwv9x5wHUSuYIOgsHe1Z6PVCpzaHa25QEpU=; b=aGrdrk501Q3ypte0bKHmsOiiH4F134JVcL5ntPJi2D2ZMvxg2+EA5UnibPvJKF4hFG oLlFG8WaM2heSNIcoiaQrS15k1q0Fg+e5S9CZho2XBBLUFlpO1wHMyTZWM/Q8zszY/Is qoOBijmnQL0y2f280sGCuXH3uxVReQzi4pS3sAcY8QYOGaD07uBHKBRryOrfMdAlXFAS eIbuI465OgDIxnPJP5wQkfuRKAX1nI26g/L3Ym2gPOOLt/lLnsp9kISuriwJp9qYS+ET yBh6+qRnOT6j8PGzQL8JVkLkGnV/krNZK3h80qvibJ91NZkq9LQlP5JvwZkKs0NH+WtI W1fg== X-Gm-Message-State: AOPr4FWAFlm5Db/9ss0YJc33A7PVmfJjeKBloE7LHp6dTBHkRxx+WQgBtu1DC3XaR5ZYgQ== X-Received: by 10.112.63.202 with SMTP id i10mr7005940lbs.93.1464069528708; Mon, 23 May 2016 22:58:48 -0700 (PDT) Received: from nikita-pc (broadband-95-84-234-130.nationalcablenetworks.ru. [95.84.234.130]) by smtp.gmail.com with ESMTPSA id h18sm221460lbb.8.2016.05.23.22.58.47 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 23 May 2016 22:58:48 -0700 (PDT) Content-Type: text/plain; charset=koi8-r; format=flowed; delsp=yes To: "Levi Morrison" Cc: "internals@lists.php.net" References: <5388A629-AA48-4CB8-8106-90BAA9B9F227@gmail.com> Date: Tue, 24 May 2016 08:58:48 +0300 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: User-Agent: Opera Mail/12.17 (Win32) Subject: Re: [PHP-DEV] [RFC] [Vote] Callable types (now: Callable prototypes) From: inefedor@gmail.com ("Nikita Nefedov") On Mon, 23 May 2016 22:52:18 +0300, Levi Morrison wrote: > On Mon, May 23, 2016 at 1:19 PM, Nikita Nefedov > wrote: >> >>> On 23 May 2016, at 19:31, Levi Morrison wrote: >>> >>> 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 values 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 you'd like to pass some kind of 'default' value >> implicitly, you as a caller shouldn't impose on the callee >> responsibility to have this same value in his definition and instead >> just pass your argument explicitly... or if you don't need this >> parameter (as in you don't plan to pass anything explicitly) then you >> 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 >> default values are part of an interface yet their invariance is not >> enforced, yields an interesting sort of possible LSP violation. F.e. if >> we have an interface Logger (a completely unreal example but it shows >> what can go wrong) with function 'log($message, $level = LOG_DEBUG);' >> and a funny implementation that decided to change default value of >> $level to LOG_ALERT, then all callers 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 produce unneeded noise in >> the logs with their alert level messages which were intended to be >> debug messages :( > > Please document this restriction in the RFC. I guess I'm the only one > who expected it to be there since it didn't come up before, but it > just seems missing. You don't need to take it out of voting for this > clarification, imo. Morning, sure thing, added it in the RFC