Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68206 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30254 invoked from network); 19 Jul 2013 16:36:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jul 2013 16:36:49 -0000 Authentication-Results: pb1.pair.com header.from=rdlowrey@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rdlowrey@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.180 as permitted sender) X-PHP-List-Original-Sender: rdlowrey@gmail.com X-Host-Fingerprint: 209.85.223.180 mail-ie0-f180.google.com Received: from [209.85.223.180] ([209.85.223.180:65035] helo=mail-ie0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A4/C9-13120-02B69E15 for ; Fri, 19 Jul 2013 12:36:49 -0400 Received: by mail-ie0-f180.google.com with SMTP id f4so9681619iea.39 for ; Fri, 19 Jul 2013 09:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=nnigZIB2LBZV1Z/uaaozajihO5NU5U4OP9l0PCj1P9E=; b=on7N33CePjhhBR1dz9QV3KBxYAbJotHIE786AVC0V+z0xataSqGWqdhYXaC9ceoBNh k9TiGsOG4kgs212Ey5HDrqYipgvplhi0mXfVqEOpiGewbTUbkBcaEG6/aMW0m4vDmXyB EWrRPirpWnyJfsx1rgqCxMLel0LSoUpF3c3ZUpHPIiH/CojZPp6uAqwvYPbTwt+ASoNt c+15sdiH2HWJxJIDm406n2kgesENmF3cDM4wyGpZUP4QvwAYKwyc/Azzz3aqeqza3oLu qGQXAPEq+M7P2oR8E0zUUX208yEWY9PMHqi+Up6jKk6jisQNhKw4A8uPriyNPUniv9An N6kA== MIME-Version: 1.0 X-Received: by 10.43.168.67 with SMTP id nh3mr11348751icc.33.1374251805930; Fri, 19 Jul 2013 09:36:45 -0700 (PDT) Received: by 10.50.7.1 with HTTP; Fri, 19 Jul 2013 09:36:45 -0700 (PDT) Date: Fri, 19 Jul 2013 12:36:45 -0400 Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c20edcb97d9c04e1dfee8d Subject: Language constructs and callability From: rdlowrey@gmail.com (Daniel Lowrey) --001a11c20edcb97d9c04e1dfee8d Content-Type: text/plain; charset=ISO-8859-1 I have a simple question about the callability of language constructs and whether or not that's something that might change in the future. Consider: var_dump(is_callable('echo')); // bool(false) var_dump(call_user_func('echo', 'foo')); // E_WARNING echo('foo'); // foo var_dump(is_callable('isset')); // bool(false) var_dump(isset(1)); // E_ERROR Obviously this behavior arises because tokens like `echo` and `isset` are language constructs and not functions. I can see some potential benefits for working around this. For example, say I want to filter only the NULL elements from an array but keep the other "falsy" values. Recognizing `isset` as callable would allow me to do this: var_dump(array_filter([0, FALSE, NULL], 'isset')); // [0, FALSE] Of course, this limitation is trivial to work around with a userland callback to check for the explicit NULL equivalency, but it would be nice to avoid the hassle. So my question is ... How deeply ingrained into the engine is this behavior? Is there any chance of language constructs ever passing the tests for callability or is that just a pipe dream that's not worth the implementation effort? --001a11c20edcb97d9c04e1dfee8d--