Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23979 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79472 invoked by uid 1010); 7 Jun 2006 18:52:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 79457 invoked from network); 7 Jun 2006 18:52:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jun 2006 18:52:53 -0000 X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:41700] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 3A/9C-00946-48027844 for ; Wed, 07 Jun 2006 14:52:52 -0400 Received: from baumbart.mbo (dslb-084-063-006-158.pools.arcor-ip.net [84.63.6.158]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id D113535C1EA; Wed, 7 Jun 2006 20:52:48 +0200 (CEST) Date: Wed, 7 Jun 2006 20:52:56 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <762216350.20060607205256@marcus-boerger.de> To: Ilia Alshanetsky Cc: internals@lists.php.net In-Reply-To: <286CF0DE-43A7-4987-8AE4-97FEE62A1A5A@prohost.org> References: <286CF0DE-43A7-4987-8AE4-97FEE62A1A5A@prohost.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Clone Operations From: helly@php.net (Marcus Boerger) Hello Ilia, hello should be printed. As in you cannot outsmart what some people might do in their code. For example in C++ such stuff gets optimized out but only as long as the compiler detects that doing so does not result in a different bahvior. This is something you need to know for particular stuff in c++ like the ability of some compilers that can optimized out implicit clone on function return - but only if the compiler would generate the clone....ok, now back to php, do we really want to make it that complex? I think if the programmer writes clone or it is a consequnce of something else then let the clone happen and the rule end there. best regards marcus Wednesday, June 7, 2006, 3:56:44 PM, you wrote: > When it comes to "empty" clone statements, should they be executed > and then free the result (current behavior) or avoid clone all together. > For example when class x { function __clone() { echo "hello"; } } > clone new x(); code is executed, should it print hello or not print > anything at all, treating the clone operation as a NOOP? > Current behavior calls clone and then frees the result, meaning that > "hello" is printed, but I am uncertain that this is the correct > behavior, any comments? > Ilia Alshanetsky Best regards, Marcus