Go API Wiki Site
Stazer opened this issue · 2 comments
Hey,
first of all thanks for your work. I really enjoy using zygomys!
I just wanted to mention that the hash examples on the Go API Wiki Site are not correct which might be confusing.
Thanks!
Best Regards
what do you mean, specifically?
The use of the HashSet
, HashGet
, HashGetDefault
and HashDel
methods.
var hash SexpHash
HashSet(&SexpStr{S: "hello"}, &SexpStr{S: "world"})
expr, err := HashGet(hash, &SexpStr{S:"hello"})
expr, err := HashGetDefault(hash, &SexpStr{S:"bar"}, &SexpInt{})
err := HashDel(hash, &SexpStr{S:"foo"})
It should be:
var hash SexpHash{env: env}
hash.HashSet(&SexpStr{S: "hello"}, &SexpStr{S: "world"})
expr, err := hash.HashGet(env, &SexpStr{S:"hello"})
expr, err := hash.HashGetDefault(env, &SexpStr{S:"bar"}, &SexpInt{})
err := hash.HashDelete(&SexpStr{S:"foo"})
Furthermore I saw that HashGet
, HashGetDefault
and HashDelete
require the environment as argument. Shouldn't they use the environment of the hash passed as pointer receiver? HashSet
is doing that already.