Odin-lang目标是取代 C 的编程语言
Odin 是一种快速、简洁、可读且实用的编程语言,其希望用以下这些目标取代 C:
- 简单
- 高性能
- 为现代系统构建
- 快乐编程
特性:
- 内置类型:strings、array、slices、dynamic arrays、maps、128-bit integers 与 endian-specific integers
- 多返回参数
- 一致的值声明语法
- 参数多态性
- 没有完全编译时执行编译时间条件(when 语句)和状态
- context 系统和内存分配器系统
- 显式过程重载
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);
}评论
