On Monday, 22 January 2024 at 11:31:11 UTC, zjh wrote:
>On Monday, 22 January 2024 at 08:54:54 UTC, zjh wrote:
>struct Person {
string name, email;
ulong age;
}
Person a{"n","email",33};
C++ can achieve ultimate simplicity without violating DRY,
And here, D violates the DRY principle!
Moreover, as the package level, module level, class level, member level, D language violates integrity.
Because D has no class level limit.
These are all not serious states.
You know you can use struct literals in initializers, right?
import std.stdio;
struct Person {
string name, email;
ulong age;
}
void main() {
Person p = {name: "Joe", email: "joe@example.com", age: 30};
writeln(p);
}
Permalink
Reply