glycerine/zygomys

How do I export functions from go into a package.

ericfode opened this issue · 1 comments

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?

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.