Releases: vitreo12/omni
Releases · vitreo12/omni
0.4.2
0.4.1
0.4.0
0.2.3
0.2.2
0.2.1
0.2.0
0.2.0
-
Support for command-like calls. Just like
nim
, it works for one arguments only:a = Data 10 a = Data(10) #equivalent
-
Support for
new
statement, both asdotExpr
and command:a = new Data a = new Data 10 a = new Data(10) a = Data.new() a = Data.new(10)
-
Explicit casting at variables declaration will keep the type:
a = int(1) #Will be int, not float!
-
Variables and
Buffers
can now be declared from theins
statement:ins 2: buffer Buffer speed {1, 0, 10} outs 1 init: phase = 0.0 sample: scaled_rate = buffer.samplerate / samplerate out1 = buffer[phase] phase += (speed * scaled_rate) phase = phase % buffer.len
-
Added
tuples
support:def giveMeATuple(): a (int, int) = (1, 2) #OR a = (int(1), int(2)) b = (1, 2, a) #(float, float, (int, int)) return b init: a = giveMeATuple() print a[0]; print a[1] print a[2][0]; print a[2][1]
-
Introducing
modules
via theuse
/require
statements (they are equivalent, still deciding which name I like better):One.omni:
struct Something: a def someFunc(): return 0.7
Two.omni
struct Something: a def someFunc(): return 0.3
Three.omni:
use One: Something as Something1 someFunc as someFunc1 use Two: Something as Something2 someFunc as someFunc2 init: one = Something1() two = Something2() sample: out1 = someFunc1() + someFunc2()
For more complex examples, check the
NewModules
folder inomni_lang
's tests. -
Better handling of variables' scope.
if / elif / else / for / while
have their own scope, but won't overwrite variables of encapsulating scopes.init: a = 0 if in1 > 0: a = 2 #Gonna change declared a b = 0 #b belongs to this if statement else: a = 3 #Gonna change declared a b = 1 #b belongs to this else statement