From 17c97d51354e1db735db3166d963d13f1e7cb9eb Mon Sep 17 00:00:00 2001 From: gered Date: Thu, 20 Feb 2014 18:12:10 -0500 Subject: [PATCH] add doc comments to explicitly state what the default setting is --- src/clj/clj_rhino.clj | 3 ++- .../org/marianoguerra/rhino/DynamicScopeContextFactory.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) 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;