Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105951 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49047 invoked from network); 16 Jun 2019 15:11:54 -0000 Received: from unknown (HELO mail-qk1-f178.google.com) (209.85.222.178) by pb1.pair.com with SMTP; 16 Jun 2019 15:11:54 -0000 Received: by mail-qk1-f178.google.com with SMTP id m14so4580713qka.10 for ; Sun, 16 Jun 2019 05:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fgXPW9+QJuYX66GILlFi1GGJghAKMMjFM+Z8nDtTbPs=; b=skdc1WsEYSj2AdMpU3T189T5Spfnj5f2mw545ZXMcoqJrgcJBbttz+WGhXaNvXPT0F jp/slEWtkhMNHJY6U3bH4L96Et4I7vnMkkwvd/jLrqGsk0pi4iP02gG9hXuTY9qPEBhP D2aAIRzQHL5rMCbcyOqXfIcRaJMvFWU2j1KKdlnFgDBG7ZPCdh1mTZ8L6d0QGD5HOOkr vVz8N641MqlVaHf/qQPuxVmk+j+oTCi6c/RcHEVBxlxRH+wATZlcqa1hlIIAjN60Ttkq 2H9qbgZbptL9bK2FgJcufKjICl/m+bzaWzZhbc09yYS5KRNUSiPzrfPxdIwLyTjIQ/e2 Ik4Q== 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=fgXPW9+QJuYX66GILlFi1GGJghAKMMjFM+Z8nDtTbPs=; b=U1avzRb/ig2suArp3NEGge0T7ZQLxbM7QNMz487zIoU+CCcSxttbrfAC2r2s14Faf7 yMQEeG4F901xLLqc9xzboYY9Uu0HYghXf+2GTbGWVxSGKHWtWqzyWfV3KKsmnJlI0qoF Wm9rHX6L7nI++a+tuc4kpTjqglvEs5wHyn6G248XRMlfSXUk0oUxeEXJGvKI6Zr73JJG RRzV3vI2S1FY7C0xFBb3OFLaWJPwtB2niHU+hCZ+EE8jaoAXAZsHsigtLeWSA+8D6X3w RYCyvV0+17Yqcd0NcUN29T3LTH/itNtb/nexGSxot9XREozD0B2zH7Gh5W4q5B9JMWay s3qw== X-Gm-Message-State: APjAAAX7gw8FLfIy6rZTn1r5Sahm1BkcSn3gBxR3uJOFr3zljYc1YNbI 5vVDW3EbRfOtXwfOjvx51afE3ARCKscHj0uW4wk= X-Google-Smtp-Source: APXvYqyaUuhhIxA/lH5ozSAEDbSXRCBc60V/okKMbJUq1qevrl16q+HzWpP93cPd+Hbnl0e3BZSGe6zbPIv0V6dt8zA= X-Received: by 2002:a37:6b42:: with SMTP id g63mr69038265qkc.80.1560687947728; Sun, 16 Jun 2019 05:25:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 16 Jun 2019 14:25:37 +0200 Message-ID: To: =?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?= Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000bac9dc058b6ffad8" Subject: Re: [PHP-DEV][RFC] Alternative "use" syntax for Closures From: netmo.php@gmail.com (Wes) --000000000000bac9dc058b6ffad8 Content-Type: text/plain; charset="UTF-8" Hi Alexandru, I don't think there is intention to do that. In particular with pass by reference. Importing variables by-ref likely will be explicit, given recent discussions on the matter. The new Closures or the old ones might automatically "copy" all variables (by-value) at some point, but I doubt they will ever "inherit" variables automatically (by-reference). Hence the proposed syntax or some other one will be needed for that. e.g.: ``` $foo = 123; $fn1 = fn() => { echo $foo; // auto import by value }; $fn2 = fn() => { use &$foo; // import by ref echo $foo; }; $foo = 456; $fn1(); // 123 $fn2(); // 456 ``` --000000000000bac9dc058b6ffad8--