Skip to content

Modules system for the language #6

@gabyfle

Description

@gabyfle

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().

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestfeaturesNew feature for the programming language

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions