2 ms·
I wrote a similar python typechecker some time ago (https://github.com/cabalamat/ulib/blob/master/debugdec.md https://github.com/cabalamat/ulib/blob/master/debu
by cabalamat 12y ago
I wrote a similar python typechecker some time ago (https://github.com/cabalamat/ulib/blob/master/debugdec.md https://github.com/cabalamat/ulib/blob/master/debugdec.md). My syntax is somewhat less verbose so this:
@returns(int)
@params(a=int, b=int)
def add(a, b):
return a + b
becomes:
@typ(int, int, ret=int)
def add(a, b):
return a + b
I was inspired to do it like that by Haskell's very clean type syntax.
Senko's version has the advantage that you can compose types in it, e.g. {str:int} is a dictionary whose keys are strings and values are integers.