We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
draft:
a:int = 10 a:string = "string"
it will not throw type fail exception, instead a will be two instance one is typed int the other will be typed string
a
int
string
f = (a:int) -> int a f = (a:string) -> string a
f now also has two instance
f
b:int = f(a) # will use the instance int -> int b:string = f(a) # will use the instance string -> string
b = f(a)
but what if the type of b is not specified? for simplicity just use the first type it matches.
b
The text was updated successfully, but these errors were encountered:
better design add keyword dyn
dyn
dyn a = 1 # dyn [number] dyn a = "string" # dyn [string] c = (x:number) -> number x c(a) # number
rewrite
a = {} a["number"] = 1 a["string"] = "string" c = (x) x c(a["number"])
just a syntax sugar for map
dyn f = (x:number) -> number { if x.lt(3) x.add(1).f else x }
f = {} f["number->number"] = (f)(x) if x.lt(3) x.add(1).f else x f["number->number"] = f["number->number"](f["number->number"])
rewrite ignore dyn rewrite let rec
Sorry, something went wrong.
LemonHX
No branches or pull requests
draft:
it will not throw type fail exception, instead
a
will be two instance one is typedint
the other will be typedstring
f
now also has two instancebut what if the type of
b
is not specified?for simplicity just use the first type it matches.
The text was updated successfully, but these errors were encountered: