-
-
Notifications
You must be signed in to change notification settings - Fork 849
Odin vs Jai
gingerBill edited this page Feb 23, 2020
·
38 revisions
Time of writing: February 2020
- Named-Focused Declaration Syntax
usingstatementdeferstatement- Parametric Polymorphic name syntax with
$ - Implicit
contextSystem -
any(Odin) type /Any(Jai) type -
when(Odin) statement /#if(Jai) statement -
typeidtype (Odin) /Typetype (Jai) - Default procedure parameter values
- Named procedure results
- Default initialization on variable declarations
- Explicit uninitialization on variable declarations with
x: T = ---;
| Odin | Jai |
|---|---|
| Publicly Available | Private Beta Only (Currently) |
| Strong Typed with virtually no implicit conversions | Many implicit conversions similar to C++ |
| Pascal-family Type System | C-family Type System |
| Modula/Go style directory-based package system | File-based library system |
Discriminated union type |
— |
bit_set |
— |
bit_field type |
— |
cstring |
*u8 (not equivalent) |
distinct type declarations |
— |
Built-in map type
|
(User-level type) |
Slicing notation like Python/Go [lo:hi]
|
— |
where clauses for procedure and record types |
— |
switch statements which allow for multiple cases, ranges, and any/union types |
if cond=={ case x: |
Explicit parameter declaration with for val, idx in array{}
|
Implicit parameter declaration with for array { val, idx := it, it_index; }
|
| Extensive constant system which "just works" reducing the need for implicit conversions | Basic constant system |
rune type for Unicode Codepoints |
s32 (signed 32-bit integer) |
| Unicode identifiers | (Unknown) |
| Array programming | Available explicitly through operator overloading |
| — | Operator overloading |
| Explicit procedure overloading | Implicit procedure overloading |
| Zero is initialized | Default struct fields |
| Built-in complex and quaternion types | (User-level type) |
rawptr |
*void |
ptr: ^int; i := ptr^; x := &i; |
ptr: *int; i := <<ptr; x:= *i; |
proc(T) -> U |
(T) -> U |
proc(a, b: int, c: string) |
(a: int, b: int, c: string) |
#soa arrays |
(User-level type through metaprogramming and operator overloading) |
| Enumerated arrays | — |
| Iterators through procedures | Iterators through macros |
| Ranged Fields for array compounds literals | — |
Implicit Selector Expressions .A
|
|
#partial switch |
(Unknown) |
| — | Arbitrary Compile Time Execution |
| — | Compile Time AST modification |
| — | Hygenic Macros |