-file flag.
A package has canonically always been a directory, but odin allowing you to build a single-file package confused newcomers who didn't understand why they could then not access variables and procedures from another file in the same directory.
This change disallows building single-file packages by default, requiring the `-file` flag to acknowledge you understand the nuance.
`-help` for these commands also clarifies the difference.
```
W:\Odin>odin build -help
odin is a tool for managing Odin source code
Usage:
odin build [arguments]
build Compile directory of .odin files as an executable.
One must contain the program's entry point, all must be in the same package.
Use `-file` to build a single file instead.
Examples:
odin build . # Build package in current directory
odin build <dir> # Build package in <dir>
odin build filename.odin -file # Build single-file package, must contain entry point.
Flags
-file
Tells `odin build` to treat the given file as a self-contained package.
This means that `<dir>/a.odin` won't have access to `<dir>/b.odin`'s contents.
```
```
W:\Odin>odin run examples\demo\demo.odin
ERROR: `odin run` takes a package as its first argument.
Did you mean `odin run examples\demo\demo.odin -file`?
The `-file` flag tells it to treat a file as a self-contained package.
```
The Data-Oriented Language for Sane Software Development.
The Odin Programming Language
Odin is a general-purpose programming language with distinct typing, built for high performance, modern systems, and built-in data-oriented data types. The Odin Programming Language, the C alternative for the joy of programming.
Website: https://odin-lang.org/
package main
import "core:fmt"
main :: proc() {
program := "+ + * 😃 - /"
accumulator := 0
for token in program {
switch token {
case '+': accumulator += 1
case '-': accumulator -= 1
case '*': accumulator *= 2
case '/': accumulator /= 2
case '😃': accumulator *= accumulator
case: // Ignore everything else
}
}
fmt.printf("The program \"%s\" calculates the value %d\n",
program, accumulator)
}
Documentation
Getting Started
Instructions for downloading and installing the Odin compiler and libraries.
Learning Odin
Overview of Odin
An overview of the Odin programming language.
Frequently Asked Questions (FAQ)
Answers to common questions about Odin.
The Odin Wiki
A wiki maintained by the Odin community.
Odin Discord
Get live support and talk with other odiners on the Odin Discord.
References
Language Specification
The official Odin Language specification.
Articles
The Odin Blog
The official blog of the Odin programming language, featuring announcements, news, and in-depth articles by the Odin team and guests.
Warnings
- The Odin compiler is still in development.