Re:Printf(“%s %s”, dependency, injection)
by IshKebab on Tuesday October 19, 2021 @06:16AM
(#28916589)
A static class method is exactly the same as a free-standing function, it's just in the class namespace. I don't see why you think that means you can't have function composition.
[ Parent
| on HN ]
Not true. It's not first class. You can't pass a static class method to a method and then call it. You have to instantiate a Function instance or equivalent.
Re:Printf(“%s %s”, dependency, injection)
by IshKebab on Tuesday October 19, 2021 @09:38AM
(#28917951)
Ok but that's a separate weird limitation that only applies to Java.
You can pass static methods as parameters in at least C++, Python and Javascript.
Re:Printf(“%s %s”, dependency, injection)
by UncleMeat on Tuesday October 19, 2021 @11:59AM
(#28919607)
That is orthogonal. Java could easily have free standing functions that are still not first class.
Re:Printf(“%s %s”, dependency, injection)
by native_samples on Wednesday October 20, 2021 @06:15AM
(#28928910)
That's not actually true. You can use method handles to do that.