Comment

Comment by arhyth

just new to Golang (in programming in general, actually) and this bug me. in the slide, it's indicated they are semantically the same. but how?

(1) var thing Thing json.Unmarshall(reader, &thing)

(2) var thing *Thing = new(Thing) json.Unmarshall(reader, thing)

in (1) thing is a variable for a value of type Thing, while in (2) thing is a variable for a Thing pointer

shouldn't thing (2) need to be dereferenced first?

parent arhyth 7 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton