Skip to content

Suggestion: Consider using main as the public program entry point #1

Description

@L0rdCycl0p

Suggestion: Consider using main as the public program entry point

First of all, I want to say that I've really enjoyed reading through the project. The language has a lot of interesting ideas, and I'm considering contributing to it. While exploring the syntax, I noticed one thing that might be worth discussing.

Currently, programs start with:

fn __start__(): void
{
    ...
}

I was wondering whether it would make sense to expose main as the public entry point instead:

fn main(): int32
{
    ...
    return 0;
}

Why?

Using main is a long-established convention across compiled languages such as C, C++, Rust, Zig, D, Nim, Odin, and many others.

While the actual ABI entry point is typically _start, the user-facing entry function is almost always main. This makes the language immediately familiar to new users and clearly communicates where execution begins.

Returning an integer also allows programs to report success or failure through standard process exit codes, which integrates naturally with shells, scripts, CI systems, and other tooling.

Backward compatibility

If preserving compatibility is important, one possibility would be to keep __start__ internally while making main the preferred public entry point.

For example:

  • main could simply compile to __start__, or
  • __start__ could remain supported as a legacy alias.

This would avoid breaking existing code while moving toward a more familiar convention.

I'm happy to help implement this if the idea makes sense. If there was a specific design reason for choosing __start__, I'd also be interested in hearing the rationale.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions