dotnet / dotnet/vblang

Support top-level statements in a single entry-point file

Open
#102 0 comments 8 reactions 1 assignee Claimed by @AnthonyDGreen View on GitHub
Proposal Ready-to-Review
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

Today the entry point of an app has to be a Sub/Function Main (which has to be in a Class or Module). It would be cleaner for simple apps (and for learning) to just let users write top-level statements in a single file so their first program could be:

```
Console.WriteLine("Hello, World!")
```

This wouldn't be a separate scripting dialect of Visual Basic, but just a special case in the language proper. In order to avoid spaghetti nonsense I think it should be limited to a single file rather than stitching together the statements in a bunch of files in some predefined order (as F# does).

If no Main method is found and a single compilation unit has any top-level statements, those statements shall be considered the body of an implicit Main method. The implicit Main should be async by default (a win for samples) and support exit codes.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.