3 ms·
For the example you cited (anonymous struct literals), there are two parts to it: 1) It omits the constructor name. My uneducated guess is that "modern" langua
by mauricioc 4y ago
For the example you cited (anonymous struct literals), there are two parts to it:
1) It omits the constructor name. My uneducated guess is that "modern" languages try to avoid the Java-style pattern of repeating a type/constructor many times in a single line (e.g., "Point pt = new Point(0, 0)") when it can infer things to help the developer.
2) It starts with a dot, while C++'s compound literals (for example) don't. The pros and cons of this are discussed in https://github.com/ziglang/zig/issues/5039 https://github.com/ziglang/zig/issues/5039.