Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92664 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33780 invoked from network); 23 Apr 2016 18:22:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Apr 2016 18:22:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=marcio.web2@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=marcio.web2@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.54 as permitted sender) X-PHP-List-Original-Sender: marcio.web2@gmail.com X-Host-Fingerprint: 209.85.218.54 mail-oi0-f54.google.com Received: from [209.85.218.54] ([209.85.218.54:34495] helo=mail-oi0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/24-07837-26DBB175 for ; Sat, 23 Apr 2016 14:22:27 -0400 Received: by mail-oi0-f54.google.com with SMTP id k142so144316608oib.1 for ; Sat, 23 Apr 2016 11:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=TBmdPpplVH7BQ3fCY+qv15lLwgnwahjTc3Yv1qgw+NQ=; b=eD80QwIVAi6dF+wmQrCgyYI9j1G4MT576veQRIG+LU2cA+nIi6cUuKYk54WuZsYzk7 p3klmnYsToaet9Ue8pRq8gRr/bY0SRwAvsaMPBm3kc/DwEZZVdEPM2ejCXciitZax9VV 0FyPcIL+Zqrcj7xchomIV/8ZL42pcC/1v8fbqH+yuo7MApBpg0D6pgKeGFJaaVX2e8r3 sr6JCsOl3sJfM+b7YI3slyalLxe8AuJYrw5btbcJJZs898rMm8m6Uc8AO+KzcKx6kAw4 Pt1Kx6At85sSXJ0+cZ0rly/YOv2pVwi5moE6x+GG2AQOQfLtiBNHCKfcr/oyR3VcGAT9 IkUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=TBmdPpplVH7BQ3fCY+qv15lLwgnwahjTc3Yv1qgw+NQ=; b=cCJQup/QfWSKznt613C+tHJqtxJ5ZJ6X/GZAodBWDtvluj+CV0BD+YxUZH78/yQfIE vr54Agx5s+TEweQBAiitoXeX8ospctC3xvvXfmr9dhaxByvbNUD+CvDXJjvbW+hrmX1H bMxKAbC7uPb6AeVvXH2jzEZj/eStM9o6Sa4XAYYDUtCVLOPIbU0M+f74rAVkjasqk9k6 IP0wehckNC/bhqDXZvww47qVPaXc9dqq8Bhyha/c3Okdt3oEJNOI5RawIO9sxLKHSO1m B2pyTC+qaFh/bTvYQ95tkPGH9crUzKeIfFX84JugFqhJi10yxuN/sxyIaMs1Gbz9Z5zI JZYw== X-Gm-Message-State: AOPr4FUl9tK21ZDGQT2GBmLJwjckJofu5BGq8UaKHPje0Y1Vag1sWmbvfZYRuO/AyB6XA0OkMg0LuUhGk8kOXg== X-Received: by 10.157.45.81 with SMTP id v75mr11703842ota.85.1461435744262; Sat, 23 Apr 2016 11:22:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.192.198 with HTTP; Sat, 23 Apr 2016 11:22:04 -0700 (PDT) Date: Sat, 23 Apr 2016 14:22:04 -0400 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=001a113e9f6666305e05312b06a7 Subject: [PHP-DEV][RFC] Callable Types From: marcio.web2@gmail.com (Marcio Almada) --001a113e9f6666305e05312b06a7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Redirecting this to the list as this message was sent privately probably by accident :) ---------- Forwarded message ---------- From: Mathieu Rochette Date: 2016-04-23 12:44 GMT-04:00 Subject: Re: [PHP-DEV][RFC] Callable Types To: Marcio Almada On 04/22/2016 06:12 AM, Marcio Almada wrote: Hello everyone, We just completed the draft for the "Callable Types" RFC. This RFC has been recently mentioned during other type related threads on this mailing list, so it feels to be the right time to put the proposal in context: The proposal is at https://wiki.php.net/rfc/callable-types It looks very nice overall :) and would be, imho, a great addition to PHP I have a few comments, first about the optional arguments, the example in the rfc says : > // That means that foo() could call $cb and pass anything as a first argument and if it would be something that is not an instance of A the call would fail. I don't get why foo would be declared as function foo(callable() $cb) { } instead of function foo(callable($any) $cb) { } if foo intends to call $cb with an argument. what about optional arguments, eg: class Foo { private $logger; public __construct(Logger $logger =3D null) {$this->logger =3D $logger;} public doSomething(callable(int $done, int $remaining, Logger =3D null) $progressCb) { // ... for($i =3D 0; $i < $n; $i++) { // ... $progressCb($i, $n - $i, $this->logger); } } } should that be supported ? and last one, will instanceof supports this new syntax? thank you The W.I.P patch is available for testing through http://3v4l.org under the RFC tab. We count with your detailed feedback and insights. Let's have a nice, respectful and constructive conversation about the RFC and work on possible improvements! Thanks Nikita Nefedov M=C3=A1rcio Almada --=20 Mathieu Rochette --001a113e9f6666305e05312b06a7--