#More constructors for Go
1 messages · Page 1 of 1 (latest)
I'm a bit worried about adding constructors for modules where it's not desired to be able to manually set the internals - I'm not sure about doing this automatically.
But I do like inferring the args/etc, from +optional and +defaults a lot
I think being able to attach any +construct tag to a struct would be good? If that's set, then it'll generate a "constructor" function for that struct
I like the idea of having a pragma for it. I agree with Jed. Adding "magic" like this in Go feels wrong.
Isn't it a perfect match with the Go model?
- If my Go struct has public fields, they're automatically available for my callers to set at construction with
var foo = &MyStruct{Foo:"bar"}. - To avoid letting callers manually set the internals, I make sure my internals are private fields. In our case that's with
+private