-
-
Notifications
You must be signed in to change notification settings - Fork 656
Odin vs Jai
Albert Liu edited this page Sep 26, 2021
·
34 revisions
Time of writing: March 2021 (previously 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) |
— | Arbitrary Compile Time Execution |
— | Compile Time AST modification (Outdated video: https://www.youtube.com/watch?v=59lKAlb6cRg) |
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 |
— |
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 |
#modify metaprogramming |
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; } ,as well as explicit for val, index : array {}
|
Extensive constant system which "just works" reducing the need for implicit conversions | Basic constant system which can be extended with the compile time execution features |
rune type for Unicode Codepoints |
s32 (signed 32-bit integer) (No default character type) |
Unicode identifiers | ASCII identifiers (currently) |
Array programming | Available explicitly through operator overloading |
— | Operator overloading |
Explicit procedure overloading | Implicit procedure overloading (Implicit Poylmorphism) |
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) (Video: https://www.youtube.com/watch?v=zgoqZtu15kI) |
Enumerated arrays | — |
Iterators through procedures | Iterators through macros |
Ranged Fields for array compounds literals | — |
Implicit Selector Expressions .A
|
|
#partial switch |
#complete if cond == { |
— | Hygenic Macros |
— | #body_text |