Re[2]: Sv: Re: [SMARTY] assign_by_ref() and append_by_ref()
| From: | Hendy Irawan | Date: | Sat, 03 Aug 2002 07:52:36 +0000 |
| Subject: | Re[2]: Sv: Re: [SMARTY] assign_by_ref() and append_by_ref() | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5568@lists.php.net to get a copy of this message | ||
smarty-general,
> Are you sure that they want to discard references in PHP5? I will ask
I guess not. References will be there forever (for backwards
compatibility, and for many other useful things, not just for
objects). But allowing call time pass references is not a good idea
(at least, for me).
> Please don't connect references automatically with objects - you can
I agree with you. references are not objects. But in my opinion,
objects should implicitly be references. This is because, in my
experience, I've never *copied* an object to any other variable,
always copy its reference. Even for "new"ing, eg:
$myobj = &new MyClass;
This syntax, is, definitely, very weird.
> also use them for other values. So you could assign a string to
> smarty and change it later without having to call assign() again.
Yes, using references this way is great. But I guess dual function of
assign() is not possible until PHP has something called function
overloading.
> function fetchInto(&$var)
This function isn't "similar" to assign.
Doing fetchInto('a string') will give you an error.
And if you change the *declaration* of fetchInto(&$var) to
fetchInto($var) (which is undoubtably useless), and then call
fetchInto like this:
fetchInto(&$put_my_data_here);
This will work *only* as long as allow-call-time-pass-reference
configuration is on, which is for now, but not in the future (and
maybe gone someday).
> So again: I don't see a need for assign_by_ref() or append_by_ref().
> An assign() allowing both is the best solution.
Please, tell me, how will you do that without
call-time-pass-reference?
Salam hangat,
Hendy Irawan - www.GaulDong.NET
Kantor: (021) 5260467 [SoftVation]
Kos: (021) 5261839 [kamar 3]