diff --git a/src/clj/clj_rhino.clj b/src/clj/clj_rhino.clj index 13f7ff7..8ecd637 100644 --- a/src/clj/clj_rhino.clj +++ b/src/clj/clj_rhino.clj @@ -13,7 +13,8 @@ (defn toggle-dynamic-scope! [enable] "enables/disables creation of either 'normal' scopes or dynamic scopes. this - will only affect scopes that are created after calling this function." + will only affect scopes that are created after calling this function. the + default setting is to create non-dynamic scopes." (DynamicScopeContextFactory/toggleDynamicScopeCreation enable)) (defn with-context [fun] diff --git a/src/java/org/marianoguerra/rhino/DynamicScopeContextFactory.java b/src/java/org/marianoguerra/rhino/DynamicScopeContextFactory.java index de0543c..6d3f02e 100644 --- a/src/java/org/marianoguerra/rhino/DynamicScopeContextFactory.java +++ b/src/java/org/marianoguerra/rhino/DynamicScopeContextFactory.java @@ -4,7 +4,9 @@ import org.mozilla.javascript.Context; import org.mozilla.javascript.ContextFactory; public class DynamicScopeContextFactory extends ContextFactory { - static boolean useDynamicScope; + // default is to use non-dynamic scopes, which is to maintain compatibility with how clj-rhino worked + // before this addition + static boolean useDynamicScope = false; public static boolean toggleDynamicScopeCreation(boolean enable) { useDynamicScope = enable;