mbeckerle commented on pull request #385:
URL: 
https://github.com/apache/incubator-daffodil/pull/385#issuecomment-642286754


   Many of the idioms we're using in Daffodil (in the schema compiler part 
anyway) are functional programming based. Lazy evaluation with value capture is 
essential to get linear behavior. Changing lazy vals to def can cause an 
exponential growth in computation simply recomputing the same thing multiple 
times (when that recomputation is happening in a recursive nest). So the rule 
of thumb is use def for abstract methods or methods with arguments or 
constants. Use lazy val everywhere else, and nothing can use side-effect or 
order-of-evaluation dependent computations. This of course applies to the 
schema compiler. Once we get to the runtime engine, imperative java-style code 
is the rule, and lazy evaluation and functional programming idoms like 
map/reduce/fold/loop-comprehensions are pretty much not used at all. 


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to