Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93454 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1430 invoked from network); 23 May 2016 19:27:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 May 2016 19:27:48 -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.180 as permitted sender) X-PHP-List-Original-Sender: inefedor@gmail.com X-Host-Fingerprint: 209.85.217.180 mail-lb0-f180.google.com Received: from [209.85.217.180] ([209.85.217.180:35461] helo=mail-lb0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/BB-14293-2B953475 for ; Mon, 23 May 2016 15:27:46 -0400 Received: by mail-lb0-f180.google.com with SMTP id ww9so58659769lbc.2 for ; Mon, 23 May 2016 12:27:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:subject:references:date:mime-version:content-transfer-encoding :from:message-id:in-reply-to:user-agent; bh=bvcnrZnJlsxP2cCz8GMvUNPClrXVWC/pAc8r/FhE+xA=; b=IPj2UfQBDhJE5L3bo1Uh8vfbzKGipl+c8WqlyhS9RaVaS2ar/cw9840CWT1TbhI4G3 VhTFxONXc94P0XboCoz413KARWplcZPBwPszvZ2RqzLWqVBcTvzjIBEEkhl6BNVBiWdK 9x8vQSfxf69y7swRplIUQF1TGTugzv/AjE6b+ADsc2HZGHTCS+kgBSdTtXfFVVT6wqUj bNpmOqWDoPpBza6xPVGOnvnGmKuVj91XF1Z3n2HiPzTNQ/s9PXrX0psKTyc7y4YKfjS5 LtxOjB8TR7Bkng1CuXAyhh6T+WPboqZnh2ad89IMabkUAKYR6VU48YrVlr8nPi1aiwOS qmtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=bvcnrZnJlsxP2cCz8GMvUNPClrXVWC/pAc8r/FhE+xA=; b=dNZM4X4rpz5GfWn3XLSTqJEiRz67WOBPuhK5sT/qPH///Umc2fCqHSNZ2EzcW25Emg 3/G4VTczpZFPlgpkyzsyw3LDPg/WDrQXUwP/ppTqw3glEsgyVo9cPgNpqn1uRcdOBz5f EecWoYLqFyiaoOiBOF+ivXPgQ0tBjdJi05APPWUM77yKcHcHqEI8Y+r50avQdP9+07Wf 8jvndn1XIIL+dMj+QvMLY2Hd8n2RI3Z3AXq8sWIqJD79K+oOYcGxUxOTOcO2JVbktri6 K8jL/bq/NRX/AbPSex7xO2km/FaEvfSuYO4+5l+NMY3nO7pIkGc4FDDLkDsspJ0ke9HG mGAA== X-Gm-Message-State: AOPr4FX6L11XHmvUB0/SnJMbXLL7I9HidWGGVR31BtNMxgF+t94JS/QlKjkXCrRjP8uflw== X-Received: by 10.112.44.37 with SMTP id b5mr5740044lbm.59.1464031663452; Mon, 23 May 2016 12:27:43 -0700 (PDT) Received: from nikita-pc (broadband-95-84-234-130.nationalcablenetworks.ru. [95.84.234.130]) by smtp.gmail.com with ESMTPSA id rs2sm6073078lbb.33.2016.05.23.12.27.42 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 23 May 2016 12:27:42 -0700 (PDT) Content-Type: text/plain; charset=koi8-r; format=flowed; delsp=yes To: "internals@lists.php.net" References: Date: Mon, 23 May 2016 22:27:42 +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") Hi Bob, When you pass an `int` to a `string` type parameter in weak mode it's being coerced to the needed type (not just directly passed). This is quite complex, because you'd need to copy zend_function and all its members (without changing the original zend_function). I would love to support it but all in all it comes down to implementation here for me, so I'd rather do it in a separate RFC. If you meant accepting `function(string $foo){}` as an argument of `callable(int)` parameter without coercing then this would be impossible due the fact that this all is context-dependent. Which means that the function which got `function(string $foo){}` in place of `callable(int)` could itself be strict-mode and when it would call this function it would raise a TypeError. On Mon, 23 May 2016 20:05:50 +0300, Bob Weinand wrote: > Hey, > > I have a question regarding strict/weak types. > > Currently, you cannot pass a callable function(string $foo) {} to a > signature requiring (callable(int)), if I understood the code correctly. > > But weak types actually should allow that as it's totally fine to pass > an integer to a string in weak mode. > > Is there any particular reason to this seemingly arbitrary restriction? > > Bob > >> Am 23.05.2016 um 16:27 schrieb Nikita Nefedov : >> >> Evening internals, >> >> 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 >> >> 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. >> >> Also the reflection part was added although I'm short on time currently, >> so implementation for that will be ready later. (speaking of >> implementation, >> it also currently doesn't use cache_slots - also something I'll add when >> I have a little bit of time)