[Cosmo-dev] Re: [commits-cosmo] (br) [4567] this is a better
way not to clobber namespaces.
Bobby Rullo
br at osafoundation.org
Sat Jun 9 15:14:30 PDT 2007
I'm tending to agree with Nicola too.
One way to avoid the clobbering is to not use the "new Function()
{ lots of stuff}" singleton pattern, and instead do stuff like
cosmo.view.cal.foo = function() {...}
and
cosmo.view.cal._privateFoo = function(){...}
I know mde is not a fan of these pseudo private variables, but the
fact is that having all these long lived variables hidden in closures
makes it extremely difficult to debug. I like being able to probe the
value of a variable by popping open the javascript shell. With these
closures you cannot do that, you have to add code (debug statements
or something)
I've been running into this a lot in the Cal and Canvas code and it's
been slowing me down quite a bit.
I'd rather solve the problem of developers messing with stuff they
shouldn't (private variables) through reviewing checked in code
rather than enforcing it and making things hard to debug.
What do you all think of deprecating this practice in the future?
bobby
On Jun 8, 2007, at 10:40 PM, Nicola Piccinini wrote:
>
>> Just because we can treat namespace objects as regular objects
>> doesn't mean that we should,
>
> that's the point, I'm glad to see I'm not alone thinking that it
> could be a concern, best regards,
> Nicola
>
> _______________________________________________
> cosmo-dev mailing list
> cosmo-dev at lists.osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/cosmo-dev
More information about the cosmo-dev
mailing list