-
-
Notifications
You must be signed in to change notification settings - Fork 656
Odin vs Jai
gingerBill edited this page Feb 23, 2020
·
34 revisions
Time of writing: February 2020
- Named-Focused Declaration Syntax
using
statementdefer
statement- Parametric Polymorphic name syntax with
$
- Implicit
context
System -
any
(Odin) type /Any
(Jai) type -
when
(Odin) statement /#if
(Jai) statement -
typeid
type (Odin) /Type
type (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 |
#complete if cond == { |
— | Arbitrary Compile Time Execution |
— | Compile Time AST modification |
— | Hygenic Macros |