restrain-jit
restrain-jit copied to clipboard
Introducing nopython literals.
Currently we found speeding up the operations on original Python objects are difficult. Actually at this stage there's a great performance loss when using restrain-jit with python objects.
I'm considering about introducing following syntax to support creating native literals:
from restrain_jit.literals import L # make checkers compat with typing
def f(x):
vec = L@[1, 2, 3] # Julia's Vector{Int}
tp = L@(1, 2, 3) # Julia's Tuple{Int, Int, Int}
d = L@{1:2} # julia's OrderedDict{Int, Int}
s = L@{1, 2} # julia's OrderedSet{Int}
Also, to specify the type of some polymorphic literals:
from restrain_jit.literals import T
def f(x):
a = T[np.int64](1) # Julia's Int64
b = T[np.uint32](1) # Julia's UInt32