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
I have a small program where MOVING a type annotation adds a dynamic error.
First, the untyped program:
# 1 def cast(f): return f def identity(x): return x def app(f): return cast(f)("NaN") print(app(identity))
Second, a typed version that does not error:
# 2 def cast(f:Dyn)->Function([String],String): return f def identity(x): return x def app(f:Function([Int],Int))->String: return cast(f)("NaN") print(app(identity))
Third, moving the Function annotation to the definition of identity makes the program raise a dynamic type error:
Function
identity
# 3 def cast(f:Dyn)->Function([String],String): return f def identity(x:Int)->Int: return x def app(f:Dyn)->String: return cast(f)("NaN") print(app(identity))
This is confusing. I would expect both typed programs to error, but apparently the Function type is weaker than a type given at a function definition.
Why doesn't program 2 raise an exception? Is there a type-system-design reason, or is the reason because of Reticulated's dynamic semantics?
2
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have a small program where MOVING a type annotation adds a dynamic error.
First, the untyped program:
Second, a typed version that does not error:
Third, moving the
Function
annotation to the definition ofidentity
makes the program raise a dynamic type error:
This is confusing. I would expect both typed programs to error, but apparently the
Function
type is weaker than a type given at a function definition.Why doesn't program
2
raise an exception?Is there a type-system-design reason, or is the reason because of Reticulated's dynamic semantics?
The text was updated successfully, but these errors were encountered: