blackdrag commented on PR #3259:
URL: https://github.com/apache/groovy/pull/3259#issuecomment-6779887494

   > (3) The snippet with `int threshold = 5` inside the query does not 
compile, with or without the bridge. `VariableScopeVisitor` rejects a local 
that is already declared in an enclosing scope, including a closure parameter 
that reuses a local name. I did not special-case that into something Groovy 
otherwise forbids.
   
   I think there is a misunderstanding. That was not supposed to be two local 
variables, that was supposed to be a field/property and a local variable.
    
   > (5) The whole lowered query closure is still compiled dynamically. I tried 
not to do that.
   > 
   > `makeDynamic` on each operator is not enough for codegen. 
`StaticTypesCallSiteWriter` throws on an operator it cannot prove, and a row 
comparison is that operator. Rewriting the operators to `ScriptBytecodeAdapter` 
calls compiled the comparison and then broke `orderby x in desc` (`in` is not a 
predicate there), join conditions, and the parameter types of parallel clause 
lambdas. A static lambda also cannot capture a local of an enclosing closure, 
which is the snapshot array: the bytecode loads the outer class and casts it to 
`GroovyObject`.
   
   I think you misunderstood the point was not that the closure is dynamic, the 
point was that it forces *anything* withing to be dynamic. It may change what 
another transform intended
   
    


-- 
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