Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go API Wiki Site #44

Open
Stazer opened this issue May 1, 2019 · 2 comments
Open

Go API Wiki Site #44

Stazer opened this issue May 1, 2019 · 2 comments

Comments

@Stazer
Copy link

Stazer commented May 1, 2019

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

@glycerine
Copy link
Owner

what do you mean, specifically?

@Stazer
Copy link
Author

Stazer commented May 2, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants