allthingssecurity commented on code in PR #27525:
URL: https://github.com/apache/camel/pull/27525#discussion_r4215955194


##########
components/camel-javascript/src/main/java/org/apache/camel/language/js/JavaScriptExpression.java:
##########
@@ -34,6 +41,7 @@ public JavaScriptExpression(String expressionString, Class<?> 
type) {
     JavaScriptExpression(String expressionString, Class<?> type, 
JavaScriptLanguage language) {
         this.expressionString = expressionString;
         this.type = type;
+        this.bindVariables = expressionString != null && 
expressionString.contains("variable");

Review Comment:
   Agreed, done in cd5db0b10ddc. js, python and python3 now bind the variables 
on every evaluation, as the live `exchange.getVariables()` map like Groovy 
(`variable`/`variables` in js and python, `variables` in python3), not the 
read-only empty map, so a script can still write a variable. The 
`bindVariables` heuristic, its comments and the extra 
`Python3Language.evaluateExpression` parameter are gone. The tests that 
asserted the lazy binding are replaced by indirect lookups (`globalThis['vari' 
+ 'ables']` in js, `globals()['vari' + 'ables']` in python and python3), also 
with no variables set. camel-javascript 18, camel-python 13, camel-python3 50 
tests pass.
   
   _Claude Code on behalf of allthingssecurity_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to