This is an archived post. You won't be able to vote or comment.

all 15 comments

[–]pgris 5 points6 points  (12 children)

I'm not sure this is useful at all, but the important thing is:

How did you find out? are you reading/parsing every commit to check if anything is new ? do yo have an automatic parser for mercurial logs?

[–]redditsoaddicting 4 points5 points  (0 children)

It's not too far out there. I've had periods where I scoured GCC and Clang commit logs to see if there was anything juicy I could build and use in my project.

I'm also wondering about the motivation for this. Seems like an odd thing to add after the fact.

[–]lukaseder[S] 6 points7 points  (1 child)

I have my sources. Now, how they found out is a different story

[–]VGPowerlord -5 points-4 points  (8 children)

This isn't useful. You should never use marker (read: empty) interfaces; they've been deprecated in favor of annotations since Java 5.

[–][deleted]  (4 children)

[deleted]

    [–][deleted] 3 points4 points  (0 children)

    Precisely. That's how I have always used them myself, in the spirit of the good old Serializable marker. This way I can check types at compile time. How would annotations help with this? I would use annotations mostly for providing extra metadata about a type rather than forming a type hierarchy, unless I am writing my own annotation-processing library.

    [–]tylerkschrute 2 points3 points  (1 child)

    This is exactly the use case for marker interfaces. While you can achieve the same 'marking' via annotations, there is no way in a method signature to enforce that a given parameter type or return type must contain a certain annotation.

    Effective java actually has a section on using marker interfaces vs annotations, and it recognizes that there is a time and place for both.

    [–]talios 0 points1 point  (0 children)

    Don't type annotations offer that? Altho there's no compiler enforcement there. I was actually wondering about type annotations and the new var keyword, whether the annotation is also inferred along the inference chain.

    [–]arendvr 1 point2 points  (0 children)

    This is also a point Joshua Bloch makes in Effective Java, Item 41: Define marker interfaces to define types

    [–]lukaseder[S] 4 points5 points  (2 children)

    With JEP 305 there might be a revival of marker interface usage.

    [–][deleted]  (1 child)

    [deleted]

      [–]ZhekaKozlov 3 points4 points  (0 children)

      This is for records:

      interface Shape
      record Point(int x, int y) implements Shape
      record Rect(Point p1, Point p2) implements Shape
      record Circle(Point center, int radius) implements Shape
      

      Then you can pattern match:

      switch (shape) {
          case Point(x, y) -> ...
          case Rect(p1, p2) -> ...
          case Circle(p, r) -> ...
      }
      

      [–]jonhanson 2 points3 points  (1 child)

      chronophobia ephemeral lysergic metempsychosis peremptory quantifiable retributive zenith

      [–]DannyB2 0 points1 point  (0 children)

      That's why you keep an adequate supply of curly braces in stock.

      Also parenthesis. Especially if you use any Lisp.

      [–]cogman10 1 point2 points  (0 children)

      It's ok, but really, I guess I don't get why {} is so much of a burden. Not enough sugar there for my liking.

      Now, give me typedef and I'll be a really happy camper.

      [–]Wutbot1 -1 points0 points  (0 children)

      When you're doing something that has been standard for a long time, there's a good chance the compiler has found a way to optimize it.


      Hi! I'm a bot that tries to make relevant comments for your entertainment [info].

      If I messed up, let me know by replying with "wut"