▲ | reactordev a day ago | ||||||||||||||||
struct tags greatly reduce the boilerplate code required to map fields to fields. It’s really quite novel once you understand it. | |||||||||||||||||
▲ | masklinn a day ago | parent | next [-] | ||||||||||||||||
> struct tags greatly reduce the boilerplate code required to map fields to fields. Are you somehow under the impression that Go is unique in having a terse way to map fields to fields? > It’s really quite novel once you understand it. It's the opposite of novel, putting ad-hoc annotations in unstructured contexts is what people used to do before java 5. | |||||||||||||||||
| |||||||||||||||||
▲ | jlouis a day ago | parent | prev [-] | ||||||||||||||||
It's not very novel. There's far better ways of solving this than allowing a random string to be embedded as aux information to a struct field. Examples: F# type providers, or OCamls PPX system for extending the language in a well defined way. Macro rewriting systems also allow for better safety in this area. This allows you to derive a safe parser from the structural data, and you can make said parser be really strict. See e.g., Wuffs or Langsec for examples of approaches here. | |||||||||||||||||
|