Why is this not allowed?

ryuukk_ ryuukk.dev at gmail.com
Tue Oct 8 07:07:44 UTC 2024


On Monday, 7 October 2024 at 19:34:00 UTC, Sergey wrote:
> On Saturday, 5 October 2024 at 06:35:57 UTC, ryuukk_ wrote:
>> all other C like languages allow me to be concise
>
> Which one btw? Except C++
>
> C#, Go and Zig seems against this functionality..

Don't lie brother


go:
```Go
package main

import "fmt"

type EntityDef struct {
     stats struct {
         hp int
     }
}

func main() {

     def := EntityDef{}
     def.stats.hp = 42

     fmt.Println(def)
}
```



zig:
```Zig
const std = @import("std");

const EntityDef = struct {
     stats: struct {
         hp: i32,
     },
};

pub fn main() void {
     const def = EntityDef {
         .stats = .{
             .hp = 42
         }
     };
     std.debug.print("{}\n", .{def});
}
```





More information about the Digitalmars-d-learn mailing list