Re: [SMARTY-DEV] Re: [SMARTY] Re: [SMARTY-DEV] $smarty.session.object doesn't work in 2.5.0

From: Date: Wed, 16 Apr 2003 12:32:02 +0000
Subject: Re: [SMARTY-DEV] Re: [SMARTY] Re: [SMARTY-DEV] $smarty.session.object doesn't work in 2.5.0
References: 1 2 3 4  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1187@lists.php.net to get a copy of this message
On Tue, 15 Apr 2003, Monte Ohrt wrote: > I've always had mixed feelings about accessing outside data with > $smarty. It is handy, but goes against the priciple of assigning content > intended for use within the template. Before we had assign_by_ref(), > assigning was an overhead because an in-memory copy of the data was made > upon each assign, so using the $smarty var for this made sense. Now that > we have assign_by_ref(), I tend to assign everything I plan to use > because there is no performance penalty and it is then treated > unconditionally as assigned data, such as showing up in the debug > console. There is no performance penalty.. There is no performance penalty.. There is no performance penalty.. It's getting a bit tiring to repeat this every time references come up. :) I realize that even developers of PHP make this mistake sometimes, but one of the biggest reasons reference counting was introduced in PHP 4 is to avoid memory overhead upon assignments and function parameter passing. The difference between the following two lines is nil, if you don't intend to change the parameter passed to the function: function assign($foo) function assign(&$foo) -Andrei http://www.gravitonic.com/ "When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute, and it's longer than any hour. That's relativity." -- Einstein, on relativity

« previous php.smarty.dev (#1187) next »