Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109033 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 60555 invoked from network); 15 Mar 2020 19:28:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Mar 2020 19:28:04 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7468A1804F6 for ; Sun, 15 Mar 2020 10:50:18 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 15 Mar 2020 10:50:18 -0700 (PDT) Received: by mail-wr1-f45.google.com with SMTP id a25so18390749wrd.0 for ; Sun, 15 Mar 2020 10:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=qbHOk3UOWmN9141F7yPUbC/Kb1cBJ5yJxCGgogZZRCQ=; b=pkmBzBlKDw7nJ8XFJ3YBqHBk3Ke3c1mPkJN7+EiqhZwvxt70E49JkvN6c9+d+Wsbbb +j4K1J1ieHxSnLPSfQUqiKDKL6x/UpLvx7YdQa+39jtH2rDQfKVdILgsJaOixjpeSbFW rl0lF7ATm0Eoad/KhYgpwp5mUgJsJ4InEZQ4oxm6CCZzSzang3lEiYtA/iFG9Cl/M/8N RdzkHQP6xyJb6TMbfY+ipc6/pqbE/Whl2MVF6HmdXCiejYKAwERprGNMG5o0afLYoyfW PUdF5RkdxNkN+R//eSLLYFuFVXwuqerhCdcJE3L86eC1wMOy6MeBc1ShRn6egJbt5YQz +s8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=qbHOk3UOWmN9141F7yPUbC/Kb1cBJ5yJxCGgogZZRCQ=; b=GH+DZ83Q4sp4os4cSRDcM3qCOLZUGWcDdci+fbvTPkfBwbU/ejqSZ+ntgpXNvq+/9C Lf3eyn6wp77vUSpbZlPAY+8xabcjgoxEIFqNZmlZoPKb5rW3hbQWWrftYBaaI/OOJSVs kUKtpw0elUOH+td7P3KHi3d9TXPd7FYMu7FSftc3D0vE6D1DRxVMdKOK/4b/YeqYniMe oBAJLSJS/cKDG0PSdpvJ1YRVZw+B0CZ1v8QZsoDfUJfzcP0OSvWmUI6olIMdFxkcevTQ eY8+ahCJKJ2rR63yVxlx8aYvmSbG/Hj6+X0noxC1NqCfYkMvTralakWTfPpb9voxjIhm 6WMQ== X-Gm-Message-State: ANhLgQ0C9SnotmOOcYx2NvcXiCr47SsgfF++qfwZosXg6PhoCm3HZ71x 4GymJsQAbatYEzHhmZCULcxl1aj9 X-Google-Smtp-Source: ADFU+vu9Dg5lQX4ph1SD9TNlapLzyqY7N/lF/otRRorhO1eLTRQKhFlbMT7bzY+MNcV8Vgxph4kVYw== X-Received: by 2002:a5d:4b8b:: with SMTP id b11mr10129580wrt.341.1584294610974; Sun, 15 Mar 2020 10:50:10 -0700 (PDT) Received: from [192.168.0.14] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id n4sm10997592wrs.64.2020.03.15.10.50.10 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 15 Mar 2020 10:50:10 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <77731b0f-70d9-788c-f6bf-7663542aaa7b@gmail.com> Date: Sun, 15 Mar 2020 17:50:08 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] RFC idea: Block scoped variables with "let $x = expr" From: rowan.collins@gmail.com (Rowan Tommins) Hi Tyson, I think this is an interesting idea, but the way you describe it does seem to introduce a lot of caveats and additional restrictions. For instance, this feels very odd to me: > Correctness would be enforced as a best-effort at compile-time - the variables would continue to only be freed at the end of the function call. Intuitively, I would expect this: {     let $x = new Foo;     $x->bar(); } somethingElse(); to be equivalent to this: let $x = new Foo; $x->bar(); unset($x); somethingElse(); Could you explain a bit more what the difficulties are in implementing it this way? Regards, -- Rowan Tommins (né Collins) [IMSoP]