Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85224 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11013 invoked from network); 19 Mar 2015 17:48:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Mar 2015 17:48:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.171 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.214.171 mail-ob0-f171.google.com Received: from [209.85.214.171] ([209.85.214.171:34608] helo=mail-ob0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/F3-25408-EDB0B055 for ; Thu, 19 Mar 2015 12:48:15 -0500 Received: by obbgg8 with SMTP id gg8so60284680obb.1 for ; Thu, 19 Mar 2015 10:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=+EQNX0hl7vZRRnnur2Job+lHlE3guZBf58g8izPuRVc=; b=RXpMabS7nhEWbc37srtCFQMNvYSe9cLyr7G0u7IMMDVX/CdLnJnrCZu8tRSJ3QUoIG EomYuPmKvg4q5qCBhe+EAXYuQyXHj/D3ysf/i2C3YrOpmUNgfMclwwaaLyd0F63pA7+Y 8gFhQ4+zg1xLfe3nHyqw/nkmJ+pbHuAejO1z8A1cbsZVXqWq7M/U/aYpHnd2xx7fCySJ Ttl1N/SNmMCfS15BKih8pAFrHJt2gFN/fhahFMadZWfPSVvXnujJmVPJ24ab2+eC5mRt 3Rb+F/0ZW51bb99oXLjfE6yNSJpOackiHh7YYKGiToWObDqh4NgWwZ/1pQXtC/oyQu3Z JcRA== MIME-Version: 1.0 X-Received: by 10.182.199.70 with SMTP id ji6mr62019439obc.3.1426787291947; Thu, 19 Mar 2015 10:48:11 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.76.93.143 with HTTP; Thu, 19 Mar 2015 10:48:11 -0700 (PDT) In-Reply-To: <550B0281.5000300@gmail.com> References: <54BEC072.5000507@mabe.berlin> <54C28B63.1040506@gmail.com> <54C2E405.4090204@gmail.com> <550B0281.5000300@gmail.com> Date: Thu, 19 Mar 2015 11:48:11 -0600 X-Google-Sender-Auth: PWDq-Mq3tbbIkYkJY7Da_pIaZQc Message-ID: To: Rowan Collins Cc: "Sebastian B.-Hagensen" , "S.A.N" , Yasuo Ohgaki , Nicolas Grekas , "internals@lists.php.net" , Stanislav Malyshev Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Inconsistencies in callable, call_user_func and direct variable calls From: levim@php.net (Levi Morrison) > There's then the question of what kind of object it would return - a > Closure? Some child or sibling of Closure? What methods could be usefully > provided? Yes, it's a closure. I've actually fleshed this out quite a bit, and there are a few important questions: - With methods do you allow unbound closures? `callable("Foo::method")` ? - How do you provide a context object? Two parameters? If so, what order? The object first makes more sense, but that means you have a string for your first parameter when there is only one, but an object if there are two. So you put the context second and it's kind of weird to do `callable("method", $foo)` Also note that if we had a unified table for properties, methods and constatns this is vastly simplified: - $foo::method could provide an unbound, scoped closure - $foo->method could provide a bound closure Or you do alternative grammar rules inside of callable, such that `callable(foo::method)` must would check for a method instead of a constant. All in all, I really wish we had unified properties, methods and constants. It would also have the advantage that if you have a property of an object that is a callable you could call it with normal syntax `$foo->property()` instead of having to do things like `$f = $foo->property; $f()`. Callable might work, though.