Comment

Comment by zvrba

C# allows file-level namespaces so you can write

    namespace Math;

    static class Adder {
      public static int Add(...) { ... }
    }

(one nesting level less). Next, elsewhere you can write

    namespace Whatever;
    using static Math.Adder;

    class CC {
      void M() {
        var z = Add(10, 20); // no NS qualification needed due to using static above
      }
    }

Java enforces directory structure to reflect package names, and this feature is not universally popular.
parent zvrba 1 year ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton