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

Modules system for the language #6

Open
gabyfle opened this issue Dec 20, 2023 · 0 comments
Open

Modules system for the language #6

gabyfle opened this issue Dec 20, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request features New feature for the programming language

Comments

@gabyfle
Copy link
Owner

gabyfle commented Dec 20, 2023

The next big feature will be the module system for Lice, allowing users to put various functions inside namespaces to retreive later.

Syntax

  • Opening a module
open Module;

This will populate the current namespace with all the functions from the given module.

  • Creating a module

There will be two ways of creating a module. You can create one directly throught the code, doing with the following syntax:

module Example {
   -- then you can have functions here that will be inside the Example namespace
}

But you can also create modules directly with the filesystem. This means that for example, if you have a file example.lice containing a set of functions, you can import this as a module from an other file by doing open Example.

You can also use folders to arrange your modules inside bigger modules. For example, let say I do have a folder foo containing files bar.lice and car.lice, you can open this folder module using the same syntax:

open Foo

and this will populate the namespace with functions from both modules files bar.lice and car.lice, allowing the user to use syntaxes like: Bar.example() and Car.example().

@gabyfle gabyfle self-assigned this Dec 20, 2023
@gabyfle gabyfle added enhancement New feature or request features New feature for the programming language labels Dec 20, 2023
gabyfle added a commit that referenced this issue Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request features New feature for the programming language
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant