I've found an article in russian "A modular approach to JavaScript." (http://habrahabr.ru/blogs/javascript/117069/) where the autor explains one interesting idea how temporary to open/ close acces to private variable. This trick is based on that if private variable is not simple tipy - it may be accessible through a reference outside the private scope
var MODULE = (function (my) { var _private = my._private = my._private || {}, _seal = my._seal = my._seal || function () { delete my._private; delete my._seal; delete my._unseal; }, _unseal = my._unseal = my._unseal || function () { my._private = _private; my._seal = _seal; my._unseal = _unseal; }; // permanent access to _private, _seal, and _unseal return my; }(MODULE || {})); It's useful when MODULE is broken down into files. To give an acces to part of MODULE in anothe file: MODULE._unseal(); do somthing with MODULE._private (e.g. with _private).... MODULE._seal(); It's very interesting! -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.