Re:Fluent: Static Extension Methods for Java
by haspok on Monday July 03, 2023 @05:17AM
(#36570600)
A compile-time annotation could at least control whether your plugin is allowed to transform the ADT in the given context (say: for a class). Otherwise is it not possible that it transforms the ADT even when the user did not intend to? Can this be a source of mysterious bugs?
[ Parent
| on HN ]
Re:Fluent: Static Extension Methods for Java
by rogerkeays on Monday July 03, 2023 @05:36AM
(#36570718)
The syntax tree is only transformed when instance method lookup fails. i.e. when your code doesn't compile in standard java form. You would be doing pretty well to accidentally call an extension method seeing as you either have to write them or import them.
Re:Fluent: Static Extension Methods for Java
by Etheryte on Monday July 03, 2023 @07:30AM
(#36571464)
This whole what-if scenario is a complete non-issue. Many other languages do this out of the box and have no issues with it.
Re:Fluent: Static Extension Methods for Java
by tsimionescu on Monday July 03, 2023 @08:22AM
(#36571895)
The key point is that they do it out of the box, so everyone is aware of it. As it is, it could easily interfere with some other non-standard extension plugin, for example.
Re:Fluent: Static Extension Methods for Java
by Etheryte on Monday July 03, 2023 @10:31AM
(#36573449)
Literally any code you write could interfere with some non-standard extension plugin, this is all pointless hot air.
Re:Fluent: Static Extension Methods for Java
by tsimionescu on Monday July 03, 2023 @02:12PM
(#36576766)
Which is one of the reasons not many use non-standard extension plug-ins for their compilers.