Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108508 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 34899 invoked from network); 12 Feb 2020 15:54:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Feb 2020 15:54:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C88F71804AC for ; Wed, 12 Feb 2020 06:08:15 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 12 Feb 2020 06:08:15 -0800 (PST) Received: by mail-ua1-f51.google.com with SMTP id a33so882122uad.11 for ; Wed, 12 Feb 2020 06:08:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0Dbcoyya5k0aZl5JZ2NfKAgOdbnNvHcnQBciSen7BK0=; b=vz7r/FwDR0TBFQ2Z+YppdWzmSg1u3O534uf9KyiMyg18gAk1IMQ25iFsLnk3gVjsZ/ Ii9mMWJhb5evh7KF7jYqoowhG7VtpOnd9V9YyiNl0UP2cz3fWu98n3oTGG32jCzDtaVT DnlxL1O9eZH0ipxe6slyraP2MTG19cCY0fdtky8AvzmOI24F25KFkDUgQowuDLTBjrAk BiDW6aJ7dJY5C0vXQWu5h6OO+gofZG66d8TKxPsyqdOOQHsIASh2b6VGzO6vUPEdzyEg xPgQCbBFiLXtX5vFzRtpkUZT77lRaNyl9B7PRVRoA/T+UjUeBu5/SqkqpXMw71sKBJRb Jmxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0Dbcoyya5k0aZl5JZ2NfKAgOdbnNvHcnQBciSen7BK0=; b=J5qgab0YykEhwu1FvhnZCszvJuQRS0wTK/cAOwJj9r0o6YrEUlgZmuD+h+nvNVoO82 WYjIOr1d/C46BVnsLzvkL2gAAdIGIxP5l4sRi33gyHz2lTFCiIfyYd4JoTm/MOYd8F7i WZXFKs3bFIx7TEfGDhVP7oJqudgzUW5c9L6ehWYYyz7Ot2A5ciRFbLvZpa4myPiyRtlf lQDJO9vwAvr1vay7I0/vxJOMMQzlNUoouBYQ/8fQ8zZWyeuzwtZK0MVgKET7BOU5I7Ei JATElTReyISLkRDZhSnh9bNQHcbulQjjLW716h+m0D4165yFTtQ74yS0SDjR1lBFVCRJ vfog== X-Gm-Message-State: APjAAAVQTWOnnY2JUoBSiI1CMMhm+zSpfSOozQts7mS+xAKFKD9vIO81 2xE4p4qM5wfDAnSu3RIiyRlFfqi9hChdBMumom4jvg== X-Google-Smtp-Source: APXvYqwtpW3eBtmjxUpYBlIJRdte3OBt9rNheOsXeWcnOwZ++FonHSFqIuvnXsy3yA+Dibzmj2Q9/Jp8ZV0slGG3aFg= X-Received: by 2002:ab0:64cd:: with SMTP id j13mr4738295uaq.127.1581516491222; Wed, 12 Feb 2020 06:08:11 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 12 Feb 2020 14:08:00 +0000 Message-ID: To: Nikita Popov Cc: Manuel Canga , Nicolas Grekas , Diogo Galvao , PHP Internals List Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] From: Danack@basereality.com (Dan Ackroyd) On Tue, 11 Feb 2020 at 13:19, Nikita Popov wrote: > > https://wiki.php.net/rfc/consistent_callables. > btw it's probably worth mentioning the other reason I didn't pursue https://wiki.php.net/rfc/consistent_callables. By itself, the callable type isn't much use. It only allows you to specify that a type can be called, but it doesn't allow you to specify what parameters the callable should take, or what the return type should be. Just making the callable type be consistent would be a lot of work, and possibly cause a lot of BC breaks and still not do the useful thing. Instead what would be far more useful would be allow people to define the callable signature, and use that as a type. callable some_callback(int $x, string $y) : int; function bar(some_callback $fn) { } $fn_correct = function (int $x, string $y) : int {} $fn_wrong = function (int $x, string $y) : int {} Calling bar with $fn_correct should work. Calling bar with $fn_wrong should give a type error. In my opinion, pursuing that idea would be a lot more valuable than breaking BC for callables without much gain. cheers Dan Ack