cppsp v1.5 --module system update

Published: (February 24, 2026 at 10:59 AM EST)
1 min read
Source: Dev.to

Source: Dev.to

Overview

cppsp_compiler mod.cppsp -header
Generates a .h file and turns int main(){...} into a comment.

Configuration

  • module.ini – Example entry:

    C:...\modfolder1, C:...\modfolder1

    Paths listed here are searched when resolving imports.

Importing Modules

  • You can import a .cppsp module with the import statement.
    Example:

    import a.b.mod;
    • a.b.mod corresponds to the file a/b/mod.cppsp.

    • The search starts from the parent directories listed in module.ini.

    • The import generates nested namespaces:

      namespace a {
          namespace b {
              namespace mod {
                  // ...
              }
          }
      }
  • Multi‑level namespaces are supported for @custom xxx(...) constructs.

Packages

  • The package directive is written inside a .cppsp file.
    Example:

    package d.e.f;

    This replaces the namespace that would otherwise be generated by an import such as import a.b.c.

Using Namespaces

  • The use statement brings namespaces into scope, similar to using namespace in standard C++.
    Example:

    use a.b.c;

    Any symbols introduced by @custom xxx(...) are also affected by use.

0 views
Back to Blog

Related posts

Read more »

Dependency Injection Basics in C#

What is Dependency Injection? Dependency Injection DI is a design pattern that supplies a class with the objects it needs from the outside rather than creating...

UV

Installation bash curl -LsSf https://astral.sh/uv/install.sh | sh Install a specific Python version bash uv python install 3.12 Create a virtual environment ba...