News for hackers. Stuff that matters.
Re:In Zig, What's a Writer? by caspper69 on Saturday February 01, 2025 @12:35PM (#42900168)
I'm not going to attempt to speak for java, but at least in C#, it supports virtual static methods in interfaces, including generics.

So, as I stated, you would use the interface keyword.

  public interface IFromString<T>
  {
      static abstract T FromString(string value);
  }

  public struct MyHasFromString : IFromString<MyHasFromString>
  {
      public string Text = "";

      public MyHasFromString(string value) 
      {
          Text = value;
      }

      public static MyHasFromString FromString(string value)
          => return new MyHasFromString(value);

      public override string ToString() => Text;
  }

There are no comments on this comment yet.