Re: [Karrigell-main] Include() behaviour
Brought to you by:
quentel
From: Brian O. <br...@qi...> - 2003-05-29 04:12:36
|
On Wednesday, May 28, 2003, at 04:16 PM, Pierre Quentel wrote: > As Brian noticed, the last version of Karrigell, with a separate=20 > Template module, has changed the behaviour of Include() : a variable=20= > defined inside a script which has an Include(otherScript)=A0is no more=20= > available in otherScript > This was not intentional, and is probably due to the use of copy.copy=20= > inside the "render" method in the "Script" class of Template : if I=20 > replace =A0=A0ns =3D copy.copy(globals()) > by ns =3D globals() it works like before > Now which behaviour do users find the best ? Having the whole=20 > namespace seems more convenient, but are there unwanted side effects=20= > and should we impose to explicitely pass parameters with=20 > Include(otherScript, **args) ? Just like to say what I told Pierre through private discussion. I=20 personally like it without having to put arguments within the=20 Include(). I like this because it seems more intuitive, meaning that=20 when you include a document within another document, it is as if you=20 are just extending the first document, which calls the include. Second,=20= it is easier, if you have a lot of includes running. Now, the other way, having arguments being passed into the Include()=20 function, has benefits. It is explicit, meaning you have knowledge,=20 through scanning the source, how certain variables end up where they=20 are supposed to be. I hang more to the first way, but each one has its merits. However, it=20= seems a bit crazy, at least in my opinion, to have two functions that=20 do the two different things ... you got to pick one and go with it. :-) Brian= |