<commit_before># `@main`: Type-Based Program Entry Points

* Proposal: [SE-0281](0281-main-attribute.md)
* Authors: [<NAME>](https://github.com/natecook1000), [<NAME>](https://github.com/nate-chandler), [<NAME>](https://github.com/ricketson)
* Review Manager: [<NAME>](https://github.com/tomerd)
* Status: **Active Review** (March 30 - April 8)
* Implementation: [apple/swift#30693](https://github.com/apple/swift/pull/30693)

## Introduction

A Swift language feature for designating a type as the entry point for beginning program execution. Instead of writing top-level code, users can use the `@main` attribute on a single type. Libraries and frameworks can then provide custom entry-point behavior through protocols or class inheritance.

Related forum threads:

- [Initial pitch](https://forums.swift.org/t/main-type-based-program-execution/34624)
- [Control of Swift Entry Point](https://forums.swift.org/t/control-of-swift-entry-point/25069)

## Motivation

Swift programs start execution at the beginning of a file. This works great for procedural code, and allows simple Swift programs to be as short as a single line, with no special syntax required.

```swift
// A self-contained Swift program:
print("Hello, world!")
```
<commit_msg>[SE-0281] Fix "missing or invalid dates" warning<commit_after># `@main`: Type-Based Program Entry Points

* Proposal: [SE-0281](0281-main-attribute.md)
* Authors: [<NAME>](https://github.com/natecook1000), [<NAME>](https://github.com/nate-chandler), [<NAME>](https://github.com/ricketson)
* Review Manager: [<NAME>](https://github.com/tomerd)
* Status: **Active review (March 30...April 8)**
* Implementation: [apple/swift#30693](https://github.com/apple/swift/pull/30693)

## Introduction

A Swift language feature for designating a type as the entry point for beginning program execution. Instead of writing top-level code, users can use the `@main` attribute on a single type. Libraries and frameworks can then provide custom entry-point behavior through protocols or class inheritance.

Related forum threads:

- [Initial pitch](https://forums.swift.org/t/main-type-based-program-execution/34624)
- [Control of Swift Entry Point](https://forums.swift.org/t/control-of-swift-entry-point/25069)

## Motivation

Swift programs start execution at the beginning of a file. This works great for procedural code, and allows simple Swift programs to be as short as a single line, with no special syntax required.

```swift
// A self-contained Swift program:
print("Hello, world!")
```

{'fraction_non_alphanumeric': 0.13177681044717054, 'fraction_numerical': 0.02928373565492679, 'mean_word_length': 4.990521327014218, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5607317', 'n_tokens_mistral': 818, 'n_tokens_neox': 719, 'n_words': 249}