Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88484 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65277 invoked from network); 24 Sep 2015 20:47:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Sep 2015 20:47:42 -0000 Authentication-Results: pb1.pair.com header.from=stig.bakken@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stig.bakken@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.180 as permitted sender) X-PHP-List-Original-Sender: stig.bakken@gmail.com X-Host-Fingerprint: 209.85.212.180 mail-wi0-f180.google.com Received: from [209.85.212.180] ([209.85.212.180:34801] helo=mail-wi0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/11-58589-E6164065 for ; Thu, 24 Sep 2015 16:47:42 -0400 Received: by wicfx3 with SMTP id fx3so45003206wic.1 for ; Thu, 24 Sep 2015 13:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=jqskr2Sz20m51GCfHbWVtLEEYnjqQe3f9rq99H4UMxw=; b=CGHjDky3cAnZs3tM7DMWeENC9HtrffUy3IFV+rGNqvJkNw9tVX0UdfG+1/V4LmALz0 RT4qkmCrwnKXQb+WF7m+eLPqT0+iAC3HjAXg1o4aZmDYk2LTUxf56/QB8qBsWmqbZwyd M5SS4QNKjhHe7LcJI0sm7iG9fnxQ+50Ta2isZ4NxKcD9aOWuV1qzJzmg7Qdt1tDfjfdC 0bHB5t5XgnW3bRweiXYcyujbiMfybpPOYW7K3PtRYJr3F2j4NvwDzjbDnZYz6UcjvpGH pQbP5uplAtpgIl5lq3vsLl/x4pSsgi5cyLeud4AG7nceCUTUhvXRGzpZIJMrd7HZQXTJ MiWw== MIME-Version: 1.0 X-Received: by 10.180.219.101 with SMTP id pn5mr11533607wic.89.1443127659404; Thu, 24 Sep 2015 13:47:39 -0700 (PDT) Received: by 10.194.157.97 with HTTP; Thu, 24 Sep 2015 13:47:38 -0700 (PDT) Received: by 10.194.157.97 with HTTP; Thu, 24 Sep 2015 13:47:38 -0700 (PDT) In-Reply-To: <5603A109.5040005@lsces.co.uk> References: <28.4D.56639.BB071065@pb1.pair.com> <5603A109.5040005@lsces.co.uk> Date: Thu, 24 Sep 2015 22:47:38 +0200 Message-ID: To: Lester Caine Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=001a1135ee8681268605208457e4 Subject: Re: [PHP-DEV] Re: [RFC] [VOTE] Short Closures From: stig.bakken@gmail.com (Stig Bakken) --001a1135ee8681268605208457e4 Content-Type: text/plain; charset=UTF-8 On Sep 24, 2015 09:07, "Lester Caine" wrote: > > On 24/09/15 07:39, Marco Pivetta wrote: > > - I'm still conflicted on automatically importing all of the scope into > > the closure: while it is working for functional languages, that's where > > most of the headaches come from in languages such as javascript. > > Isn't this the crux of some decisions? Once one adopts compiling as an > essential step a number of the rules can be changed. So is PHP heading > down the path of a compiled language even if that is hidden in some > automatic cache or is it still mainly an interpreted script? Lots of > things are easier if you apply optimization in the compile stage but > that then blocks many of the dynamic actions which PHP *IS* so good at. > The sort of thing that allows thousands of pages of content to be stored > in a database without some of the straight jacket that some people seem > to think is essential these days? > > If I'd wanted a fully compiled system I'd have stayed with C/C++ all > those years ago ... as I keep harping on PHPs dynamic nature is it's > strength? > I assume you mean strongly typed, because PHP has had a compiler for about 18 years ;) The main restriction on PHP's compiler is really that it has to be reasonably fast, it can't afford to do all the clever and very expensive optimizations that for example gcc does. Maybe less so today when we can expect everyone to have an op cache, but still. Auto-importing variables would not be expensive, or even noticeable. But it breaks completely from PHP's model of always being explicit about taking symbols from another scope (globals). This is a property on which PHP differs from other languages such as JS, Ruby or Groovy, which have similar constructs. Is it OK to introduce an exception to that only for the sake of having (an admittedly handy) short syntax for closures? It's one of these "you want it, but it's not good for you" predicaments. My vote will be no, unfortunately. - Stig --001a1135ee8681268605208457e4--