Draft:Odin (programming language)
Submission rejected on 15 August 2023 by S0091 (talk). This topic is not sufficiently notable for inclusion in Wikipedia. Rejected by S0091 21 months ago. Last edited by Karl.zylinski 18 months ago. | ![]() |
Submission declined on 21 November 2021 by Artem.G (talk). This submission is not adequately supported by reliable sources. Reliable sources are required so that information can be verified. If you need help with referencing, please see Referencing for beginners and Citing sources. Neologisms are not considered suitable for Wikipedia unless they receive substantial use and press coverage; this requires strong evidence in independent, reliable, published sources. Links to sites specifically intended to promote the neologism itself do not establish its notability. Declined by Artem.G 3 years ago. | ![]() |
Comment: I think If submission is rejected by an Afc reviewer, so, don't submit for review, I suggesting you, firstly you ask for advice here for your submission. ~~ αvírαm|(tαlk) 12:37, 27 November 2023 (UTC)
Comment: None of the sources used are reliable and/or independent and nothing suggests this can meet the notability guidelines. S0091 (talk) 19:34, 15 August 2023 (UTC)
Comment: of 9 refs 6 are from odin website, and 2 are youtube videos Artem.G (talk) 18:35, 21 November 2021 (UTC)
![]() | |
Paradigms | imperative, procedural |
---|---|
Designed by | Ginger Bill |
First appeared | July 7, 2016 |
Stable release | dev-2023-11[1]
|
Typing discipline | Static, strong, inferred, nominal, structural, generic |
Platform | x86-64, ARM/ARM64, WebAssembly |
OS | Cross-platform |
License | 3-clause BSD.[2] |
Filename extensions | .odin |
Website | odin-lang |
Influenced by | |
Pascal[3], C, Go, Oberon-2, Newsqueak, Jai[4], GLSL[5] |
Odin, also known as odinlang, is an imperative, general-purpose, compiled and statically typed system programming language designed by Ginger Bill.[6][7]
Odin is designed to be an alternative to the C programming language[8][9] and achieve "high performance" on "modern systems"[10], with features like compile-time parametric polymorphism, array programming, and runtime reflection.[11][12][13]
The language comes with bindings for several libraries and graphics APIs such as OpenGL, DirectX, SDL and Vulkan.[14]
Syntax and features
Odin's syntax is similar to that of Go and Jai.[15][16] The following is a simple example program written in Odin:
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)
}
Memory management
Memory is manually managed in Odin. The language has built-in support for custom allocators. Custom allocators can be passed to called procedures by assigning context.allocator
with the desired allocator.[17]
Explicit procedure overloading
Odin has procedure overloading, but unlike languages like C++, the overloads have to be specified explicitly:[18]
bool_to_string :: proc(b: bool) -> string {...}
int_to_string :: proc(i: int) -> string {...}
// "to_string" is will call either "bool_to_string" or "int_to_string" depending on type.
to_string :: proc{bool_to_string, int_to_string}
Array programming
Odin provides array programming[19][20], enabling arithmetics on array elements:
a := [3]f32{ 1, 2, 3 }
b := [3]f32{ 5, 6, 7 }
c := a * b
d := a + b
e := 1 + (c - d) / 2
fmt.printf("%.1f\n", e) // [0.5, 3.0, 6.5]
The language also features "swizzling" of arrays, similar to the operation in shading languages like GLSL.[21]
// Declaring type Vector to be the same as array of 3 f32's.
Vector3 :: [3]f32
// Cross product using swizzle function
cross :: proc(a, b: Vector3) -> Vector3 {
i := swizzle(a, 1, 2, 0) * swizzle(b, 2, 0, 1)
j := swizzle(a, 2, 0, 1) * swizzle(b, 1, 2, 0)
return i - j
}
// Cross product using shorter swizzle notation
cross_shorter :: proc(a, b: Vector3) -> Vector3 {
i := a.yzx * b.zxy
j := a.zxy * b.yzx
return i - j
}
Matrix support
A matrix
is a mathematical type built into Odin.[11] It is a regular array of numbers, arranged in rows and columns. Odin's matrix support allows for matrix-array and matrix-matrix operations making it a Level 3 Basic Linear Algebra Subprograming language.
a: matrix[2, 3]f32 // matrix that has 2 rows and 3 columns with an element type of f32
b: matrix[3, 2]f32 // matrix that has 3 rows and 2 columns with an element type of f32
v: [2]f32 // array that has 2 elements with an element type of f32
a = matrix[2, 3]f32{
1, 9, -13,
20, 5, -6,
}
b = matrix[3, 2]f32{
3, 5,
7, 9,
}
v = [2]f32{2, -4}
m := a * b // matrix-matrix multiplication
vp := m * v // matrix-array multiplication
The internal representation of a matrix
in Odin is stored in column-major format[22] while the matrix literals are written in standard (row-major like) order (e.g. matrix[2, 3]f32
is internally [3][2]f32
(with different a alignment requirement)). Column-major is used in order to utilize (SIMD) vector instructions effectively on modern hardware, if possible.
Notable software built with Odin
- EmberGen, a real-time volumetric fluid simulator by JangaFX[23][24][25]
See also
References
- ^ "Odin release dev-2023-11". GitHub. Retrieved 2023-11-27.
- ^ https://github.com/odin-lang/Odin/blob/master/LICENSE
- ^ https://gamefromscratch.com/odin-programming-language/
- ^ "Jai vs Odin systems programming languages". YouTube. Retrieved 2022-07-06.
- ^ "Frequently Asked Questions".
- ^ "Interview with Odin language creator gingerBill". YouTube.
- ^ "Learn to Code with Odin Programming Language - Introduction". DEV Community. 2023-01-06. Retrieved 2023-11-27.
- ^ "Introducing Odin Lang (Japanese)". Qiita. Retrieved 2019-09-29.
- ^ "Programming Games by Hand Using Odin". CodeNewbie Community 🌱. 2022-11-04. Retrieved 2023-11-27.
- ^ "Comparisons with other languages - C3 Documentation".
- ^ a b "Odin programming language review (quality of life)".
- ^ "Writing an Operating System in Odin". flysand7's blog. Retrieved 2023-11-27.
- ^ hasen (2022-08-25). "Why I like Odin". Hasen Judy. Retrieved 2023-11-27.
- ^ Mike (2022-04-13). "ODIN Programming Language". GameFromScratch.com. Retrieved 2023-11-27.
- ^ "Low-Level Programming with Odin Lang - Perfect for Beginners". DEV Community. 2022-09-21. Retrieved 2023-11-27.
- ^ Jai vs Odin systems programming languages (Non-spicy takes!), retrieved 2023-11-27
- ^ Zhiyanov, Anton (2023-07-31). "Trying Odin (with a playground)". antonz.org. Retrieved 2023-11-27.
- ^ "Odin programming language review (procedure groups)".
- ^ "Generating the multiplication table for octonions in Odin".
- ^ "Overview". odin-lang.org. Retrieved 2022-10-20.
- ^ "Data Type (GLSL) - OpenGL Wiki".
- ^ "Overview".
- ^ "EmberGen: Real-Time Fluid Simulations for Fire, Smoke, and Explosions!".
- ^ "EmberGen Real-Time Fluid Simulation". 9 May 2022.
- ^ "Episode 289 - EmberGen". 9 March 2021.
External links
Category:Programming languages Category:Cross-platform free software Category:Cross-platform software Category:Free compilers and interpreters Category:Programming languages created in 2016 Category:Statically typed programming languages Category:Systems programming languages