Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94118 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11701 invoked from network); 19 Jun 2016 09:57:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jun 2016 09:57:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.213.44 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.213.44 mail-vk0-f44.google.com Received: from [209.85.213.44] ([209.85.213.44:33624] helo=mail-vk0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/B9-18862-98C66675 for ; Sun, 19 Jun 2016 05:57:29 -0400 Received: by mail-vk0-f44.google.com with SMTP id d185so164735301vkg.0 for ; Sun, 19 Jun 2016 02:57:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=1QJXkE0xgRJ+YehIOyibvrMURzRQklD/8K9epd0tgN8=; b=KwB8M6jkls7WEZxokgQahcqQZc+xKp90hlv83WbqMOEXkd6MM3HS2CBIj12Rq63ESC SEmr416a9jGCp9YNooqM514XoRq66DjaUQB6qYx3zQlb53+9IrL5Itfe0yoCZNeI/OMD KrrbJD/4u7Dd8SxI6jE1O75l3bkZ1GYWaXjP8/XjkgPqoVA8/0ka3Pr6TecMpeXvZMbq 7/bCsBJn0/9lucV4I5hwdPCtBFSS7326fYNet8gD6A+8cGCFfLFVXpMO5xaZ3vOKx+5T aZsCS8QyGsX6fvXrCN5Rq/vkCrZoWULwJXQNRJm7FUs/W45Keutj9DqPhR6h6SHSWh3Q ipNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1QJXkE0xgRJ+YehIOyibvrMURzRQklD/8K9epd0tgN8=; b=GmA5ibRxM0imU+dEjCMZBVrBrXNSv2un7vEHAatAPDx28JODfVI5K9omPRgW4rlEIu kNx0M9JBSq5OY+m+/qS0//RKHAZ0x3/iTnZzCCvXwGzyOxoVqwZl+ndw2J8EIKlDIW5T lIcod6ZnUSLqyUfnmHZIOTLbkKJqo0E/HEihTHWdUSfgGdC9JqLn0yP5jxBiUHX9lBZ5 ZxSXDqJxFPRLBCsfV2supZVaX/yCySVh3YJ0rCP+YoSDroP9YNGWe3mWUsF3vLvcr+HR wN7BeGstqVM2t6wAH40sZf2y3tXIrMXf3EG8C5I26o8GvIAE67Q8ytwUq7IrftmVB4qe S3ag== X-Gm-Message-State: ALyK8tIGGsH0tynWbfCvfvK1piuCbzySNQ+k6xFeXAG1OJIK/qYUQnSNZ+GYvE+05gYgHMr3fh6i0h4m2yQnSg== X-Received: by 10.31.47.85 with SMTP id v82mr4439077vkv.140.1466330246247; Sun, 19 Jun 2016 02:57:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.88.148 with HTTP; Sun, 19 Jun 2016 02:57:25 -0700 (PDT) In-Reply-To: References: <20160617202344.2868F1A80C02@dd1730.kasserver.com> Date: Sun, 19 Jun 2016 11:57:25 +0200 Message-ID: To: Marco Pivetta Cc: Niklas Keller , Ryan Pallas , Stanislav Malyshev , Thomas Bley , "internals@lists.php.net" , michael.vostrikov@gmail.com Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] New escaped output operator From: rasmus@mindplay.dk (Rasmus Schultz) I am well familiar with this approach, and it does not scale - not only would you be aggressively loading every installed view-helper anytime you render a view, you would even be loading them when you're *not* rendering a view. I'm afraid the best we could do at this point, without changing the language, is a establish a convention for autoloading functions (and/or namespaces of functions) from files, based on static analysis of template files. But that is pretty complex - on the organizational side, it requires developers to agree on and adopt a convention, and on the technical side, you need static analysis and thereby most likely a cache layer as well. It's all possible, but most people aren't going to put up with this much complexity for something this simple. Hmm. What if we could import static methods into file scope and use them as functions? use My\Namespace::my_function; my_function(); // <-- effectively My\Namespace::my_function() This would leverage auto-loading at least... I mean, it's still effectively just abusing classes as pseudo-namespaces, so there is that - but it would work with e.g. Composer right away, and probably with many existing static classes? Yeah, it's still ugly... On Sun, Jun 19, 2016 at 11:37 AM, Marco Pivetta wrote: > On 19 June 2016 at 11:34, Rasmus Schultz wrote: >> >> > You can always add more functions to a namespace even spread accross >> > multiple files >> >> Same problem: no autoloading. >> >> You would have to add require_one statements - which, as said, is not >> really possible with Composer packages... >> > > You should look at packages that already do this: > https://github.com/nikic/iter/blob/5527ca489bf151ceef17622f1c89114640f522d2/composer.json#L16 > > Ref: https://getcomposer.org/doc/04-schema.md#files > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/