Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100790 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 442 invoked from network); 27 Sep 2017 19:39:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Sep 2017 19:39:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.180 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.180 mail-pf0-f180.google.com Received: from [209.85.192.180] ([209.85.192.180:53807] helo=mail-pf0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 96/07-34114-98EFBC95 for ; Wed, 27 Sep 2017 15:39:53 -0400 Received: by mail-pf0-f180.google.com with SMTP id x78so7747396pff.10 for ; Wed, 27 Sep 2017 12:39:53 -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-language:content-transfer-encoding; bh=r7150BARPwmB7qbX5Dv/Fi7OYb9aCJ+7L2wIrkYn3XM=; b=mVGIwjttoCEl5Rx60dFTISqMDg13FXvNa8q/hNeRn4sdCX3FVqQ6YkNELOGx/IcTwY E+qbsNGPTGU3k+Py+dwd4CU54il+LRipB7bkDgnN8F22lWlJ7uKuKHXVfqkUtpDbhw9T WclYVJbslyQHWuOtWG/sGvqc6/VHqXnzSkWex87uGUaCZAdMgGXTbyHNzTo8tTtLIEfZ pTAxC4jgQFSYpgZfLVO3VsRXAbaK0PFgbI11GpjU/IVMEPhKTNVKCYk8LYTrybRgwemz T7eYPoBDIq62ZIgdZhh1cqy9rpw3E5D70/GlFApSQfD1mRZ2FNv8caeAC0slLQRZpRxj V+yQ== 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-language :content-transfer-encoding; bh=r7150BARPwmB7qbX5Dv/Fi7OYb9aCJ+7L2wIrkYn3XM=; b=fsBiSCM+RH8TwXtdvBbvkLRBk8jYLh8v/VP9AsNxlzBqVghNKXKT31mhgqkZ/+F+Rx mO0xmeZ9Ve5tAdA6v51nA5qPqbkhXiheYFIXbUr2Z9kGN5gzF95AZU83vsPCAQ/XC7PN fsAekAmb2rZuHkNYCIUsfDmyhc6a/SMnK76MmrKHsoZHjNX2oaV8NqsBYL9w4TAiWnlj fg9Q1G1Wo2mSilX+8IUi3Ng5WOo5R865EMDvmnv88uayHcw8jt5oDNvwej4IRvUJnhR8 CK+D2vGQ+XY5db5rHcaesC09S/SWDJBHHPsnN9ydC6D+tjQzA9ARsVfn4P2yhOKy/2P0 D2yQ== X-Gm-Message-State: AHPjjUgIpVCKNKHQd2CHjzMmG+oJyNWa9TYPi5y3Oo2yNkImh539dCej mYu3IN5REXVaHDwjwQtFOMx85kY= X-Google-Smtp-Source: AOwi7QD259zxvbdhkwVJ5lJPWcoL2OJGzpc3FNvHIdfujh824mVNZzJ2kS+SWjh1GuLdZqzJxoK3mQ== X-Received: by 10.99.173.67 with SMTP id y3mr2172583pgo.69.1506541189646; Wed, 27 Sep 2017 12:39:49 -0700 (PDT) Received: from ?IPv6:2602:306:ce9c:e680:3d5f:cf1f:6019:eee6? ([2602:306:ce9c:e680:3d5f:cf1f:6019:eee6]) by smtp.gmail.com with ESMTPSA id t8sm4137833pfh.116.2017.09.27.12.39.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Sep 2017 12:39:49 -0700 (PDT) To: Sidharth Kshatriya , internals@lists.php.net References: Message-ID: <9a6611bc-ec8b-b731-63f3-74df28bc3ec1@gmail.com> Date: Wed, 27 Sep 2017 12:39:46 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Is reference counting necessary for a PHP implementation? From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > Is this statement correct? If I understand correctly many PHP projects > depend on the deterministic firing of `__destruct()` function to cleanup > SQL transactions or connections and so forth. Yes. But, strictly speaking, you do not have to use specifically refcounting - i.e. having some value to increment by 1 each time reference is added and decremented by 1 each time reference is removed - to achieve that. Pretty much none of the code requires there would be an actual counter - only that the system would behave as if there was a counter. Of course, in this case actually having the counter is the most natural way of doing it :) But if you find some other way of achieving the same semantics, I think it'd be still OK. > instead could unlock measurable performance improvements, and the behavior > of destructors could be closely imitated by a combination of try/finally > and other new language constructs. I am not sure I am convinced by this statement, and not sure how RAII patterns would work in GC-based environments (i.e. it seems to me they won't). That being said, many resource allocation scenarios can be implemented without RAII (in fact, C doesn't have RAII at all, people still manage to work with it :). -- Stas Malyshev smalyshev@gmail.com