Re:Functional calisthenics
by michaelg7x on Thursday October 19, 2017 @03:48PM
(#15511006)
In Java static methods are a particularly simple way making clear to the compiler and runtime that a given functions does not have side effects (to instances of the owning class). I can imagine that, as a pattern, they would assist escape analysis.
[ Parent
| on HN ]
Re:Functional calisthenics
by lederhosen on Thursday October 19, 2017 @05:17PM
(#15511626)
A static method can of course mutate an object of the same class (give the object as an argument (direct or indirect) or use a static variable of the class)
I can not see how they could be used to help escape analysis more than that you have one less reference (this).
Re:Functional calisthenics
by michaelg7x on Friday October 20, 2017 @02:52AM
(#15513958)
Yes, of course that's possible. I was trying to point out their usefulness to the programmer as well as potentially to the runtime/JIT. Next time I'll list the obvious exceptions!