Remix.run Logo
nine_k 4 days ago

This may be intuitively correct, but to my mind it is architecturally wrong. A good language should not tolerate ambiguity and offer to guess which behavior is correct.

wild_egg 4 days ago | parent | next [-]

It's not ambiguous though. The behaviour is very clearly defined in the language spec.

https://go.dev/ref/spec#Selectors

As far as language specs go, Go's is really quite concise and I strongly encourage everyone I onboard to spend an afternoon reading it end to end at some point in their first couple weeks.

tayo42 4 days ago | parent | prev [-]

Why is it ambiguous though? The second URL is nested

Are thy not accessed like

opts.URL == abc.com

and

opts.BarConnectionOptions.URL == xyz.com

what leads you think otherwise?

tsimionescu 4 days ago | parent [-]

If there were no duplicate URL field, say they were called FooURL and BarcoURL, you could access them as `opts.FooURL` and `opts.BarcoURL`. They are both fields of `opts`, via embedding. It's just that FooURL is embedded directly, while BarcoURL is coming from two levels of embedding.