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

Syntax: define package, imports and namespace #10

Closed
fly-lang opened this issue Feb 9, 2021 · 1 comment · Fixed by #28
Closed

Syntax: define package, imports and namespace #10

fly-lang opened this issue Feb 9, 2021 · 1 comment · Fixed by #28
Labels
good first issue Good for newcomers planning For project plan tracking

Comments

@fly-lang
Copy link
Owner

fly-lang commented Feb 9, 2021

Define the syntax for the best approach for defining a package, importing, and use in the code.
Following some programming language examples:

  • Javascript: import "modname";
  • Java: import package.*
  • PHP: use Namespace\function_name as function_alias_name;
  • Rust: use module::submodule::symbol as altname
  • C++: #include and using namespace std;
  • Go: import m "math" or import . "math"

Easy, readable and powerful

@fly-lang fly-lang added the good first issue Good for newcomers label Feb 9, 2021
@marcoromagnolo
Copy link
Collaborator

marcoromagnolo commented Feb 9, 2021

By considering a mix of Go and other languages.

Define a package for grouping and logic separation like namespace:

namespace math

While for imports you can use package (assuming math contains sqrt function):

import "math" as "m"
...
m.sqrt()

If math owns sqrt you can use:

import "math" as "."
...
sqrt()

@fly-lang fly-lang added the planning For project plan tracking label Feb 11, 2021
This was referenced Feb 11, 2021
@fly-lang fly-lang linked a pull request Aug 24, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers planning For project plan tracking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants