News for hackers. Stuff that matters.
Re:Fluent: Static Extension Methods for Java by hardware2win on Monday July 03, 2023 @04:45AM (#36570384)
In C# world they somehow manage to do it without all of this annotation oriented programming
Re:Fluent: Static Extension Methods for Java by stanac on Monday July 03, 2023 @05:09AM (#36570538)
Not really. First argument (the object you are extending) needs to be marked with `this`, which is an annotation.
Re:Fluent: Static Extension Methods for Java by hardware2win on Monday July 03, 2023 @05:26AM (#36570649)
Ehh, ive been talking about whole lang and ecosystem

But I agree about "this" being similar concept

Re:Fluent: Static Extension Methods for Java by whizzter on Monday July 03, 2023 @06:23AM (#36571015)
There are tons of annotations over the hood.

The "this" that GP mentions is for for extension methods similar to the article to be regcognizeed as such (never done if the annotation isn't present), they're written such as:

static int Foo( this Bar bar, int biz) => bar.xyz+biz;

Bar bar = new Bar() { xyz=123; };

int result = bar.Foo(456); // Works even if Foo wasn't a part of Bar initially

Elsewhere annotations(called attributes in C# land) can often be used in the same way as in Java to document serialization behaviour,etc. So in practice there aren't much differences apart from how library authors haven't embraced it entirely as much for automagic bindings (partly due to philosophy, partly due to other facilities being more appropriate).

Re:Fluent: Static Extension Methods for Java by dtech on Monday July 03, 2023 @06:59AM (#36571229)
There is a massive difference between a feature universally offered by the language and something only supported by using a specific library of compiler plugin...
Re:Fluent: Static Extension Methods for Java by dtech on Monday July 03, 2023 @06:47AM (#36571157)
What a weird take. Parent obviously meant @X meta-programming annotations, not language syntax and keywords with a specific definition.

The definition that includes it is so broad that it loses all meaning, it would make "private", "class" or "boolean" also annotations.

Re:Fluent: Static Extension Methods for Java by depoll on Monday July 03, 2023 @10:40AM (#36573568)
In .net world, the C# "this" syntax is itself just syntactic sugar over an annotation (attribute in .net parlance): https://learn.microsoft.com/en-us/dotnet/api/system.runtime....
Re:Fluent: Static Extension Methods for Java by nh23423fefe on Monday July 03, 2023 @12:14PM (#36575055)
offtopic: why is this link a broken redirect in chrome but not firefox?
Re:Fluent: Static Extension Methods for Java by ElectricalUnion on Monday July 03, 2023 @12:47PM (#36575523)
My guess is that MSDN POs prioritize testing with Blink/Edge WebView2 over other engines.
Re:Fluent: Static Extension Methods for Java by rogerkeays on Monday July 03, 2023 @04:52AM (#36570427)
Just to make it clear, Fluent does not use any annotations.
Re:Fluent: Static Extension Methods for Java by michaelcampbell on Monday July 03, 2023 @10:27AM (#36573385)
Isn't this just saying some languages do things others do not?
Re:Fluent: Static Extension Methods for Java by hardware2win on Monday July 03, 2023 @10:57AM (#36573829)
No, annotations are available in both, yet one community uses them more often
Re:Fluent: Static Extension Methods for Java by michaelcampbell on Wednesday July 05, 2023 @01:27PM (#36603740)
So, "some languages do this with annotations, others don't need it". My point stands.

I mean it's fine to not like annotations or the decision to use them, but that another language does things differently is almost a tautology and hardly worthy of note. IMO, reasonable people will disagree.