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

How do I export functions from go into a package. #29

Open
ericfode opened this issue Jun 28, 2018 · 1 comment
Open

How do I export functions from go into a package. #29

ericfode opened this issue Jun 28, 2018 · 1 comment
Labels

Comments

@ericfode
Copy link

I get how to wrap functions with the Sexp type, but when i add them to the zygo i don't want them all in the top level namespace, it makes listing the symbols not super useful and makes me worry about name collisions. What might you suggest?

@glycerine
Copy link
Owner

glycerine commented Jun 28, 2018

Zygo does have packages:

https://github.com/glycerine/zygomys/blob/master/tests/package.zy

https://github.com/glycerine/zygomys/blob/master/tests/import.zy

update: within Go, a package is represented as a Stack (don't ask me why) https://github.com/glycerine/zygomys/blob/master/zygo/stack.go#L12

Further, the import code shows how the import function creates a package: https://github.com/glycerine/zygomys/blob/master/zygo/import.go#L8

So following the import code as an example, and calling env.LexicalBindSymbol to inject your package into the environment, as import does, should get you started.

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

No branches or pull requests

2 participants