arr-ai / arrai

The ultimate data engine.
http://arr.ai
Apache License 2.0
20 stars 15 forks source link

Implement namespacing for dynamic variable names #620

Open marcelocantos opened 4 years ago

marcelocantos commented 4 years ago

Please do not post any internal, closed source snippets on this public issue tracker!

Purpose

Please describe the end goal you are trying to achieve that has led you to request this feature.

We need to ensure that dynamic variable names don't conflict across libraries.

Suggested approaches

What have you tried, and how might this problem be solved?

The convention will be that a package located at //import-path will own names matching @{{import-path}anything}. For instance, github.com/foo/bar/my/path/stuff.arrai will own @{{github.com/foo/bar/my/path/stuff}.something}. Within a package, @{{}...} will be an alias for @{{self-import-path}...}.

Packages may also define private names as follows: @{.{import-path}...}. Only the package in question will have permission to directly reference such names. By convention, this will expressed as @{.{}...}.

Sharing of private names between packages will be supported by simply allowing partial import paths, e.g. the following will be reference-able within github.com/foo/bar/my/path/stuff.arrai:

As observed earlier, by convention, relative-referencing will be used in practice: