Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Contrast this behavior against message types. While scalar fields are dumb, the behavior for message fields is outright insane.

The reason messages are initialized is that you can easily set a deep property path:

```

message SomeY { string example = 1; }

message SomeX { SomeY y = 1; }

```

later, in java:

```

SomeX some = SomeX.newBuilder();

some.getY().setExample("hello"); // does not produce npe

```

in kotlin this syntax makes even more sense:

```

some {

  y.example = "hello". // does not produce npe
}

```



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: