Re: Re[4]: mixing of asign() and assign_by_ref() overwrites external vars
boots <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <[email protected]> |
--- Dmitry Koteroff <[email protected]> wrote: D> Do, $smarty->assign("a", "b") has EQUAL paradigm as PHP's $a="b". D> Agree? Do you plan exactly this while developing assign() D> function? Is it documented? You know fully well that assign($name, $value) is a by-value (copy) assignment. Of course, I didn't write that function but I think its use is obvious. Further, I don't recall anyone having any confusion about it as long as I've been reading the lists. The thing is, if you first use assign_by_ref, then you get what's coming to you--a real reference, just like PHP would do (as you know, Smarty vars are stored in an array, so your reference is stored in an hash element instead of the local PHP namespace--big difference that). Maybe someone is already purposely using it with these semantical meanings, who knows? I suggest that anyone interested take a look at the docs for assign_by_ref http://smarty.php.net/manual/en/api.assign.by.ref.php. D> It is not a problem. You may not use deprecated syntax at all. So why add support for it, what, 2 years after it was deprecated? Does that honestly make sense to you? I mean really. D> Oh. Right, there are already are ways to deal with this. We don't have to alter what is probably the most used Smarty method to get all the goodies you suggest--its been in there all this time. D> But you surely can not modify API nor use deprecated syntax. Grrr. It does modify the API. It introduces pass-by-reference into assign() which is not what is allowed in the current or previous versions. D> So, now API is not touched, deprecated & call works as without &, D> but assign() after assign_by_ref() does not modify source D> variable. If it doesn't change the source variable, what was the point of using a assign_by_ref() in the first place? You can ignore every other point I make but if you bother to make any response at all it should be to this point. This is why in an earlier post I said it was a feature misuse--if you do not explicitly want reference behaviour, then do not explicitly ask for it in the first place. D> P.S. D> It is now question of principle, of course, not practical. Yes, if it was a practical issue, I'm sure I (and others) would lend support behind it or something like it. If it is a matter of principle, what do you suppose the principle at stake is? I for one think this horse needs to be shot :) On an ancillary note, it will be interesting to see how everything pans out in the PHP5 timeframe where all of these PHP4 copy/ref semantics take on new meanings, but that is another story... Greetings, xo boots __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php