You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Possibly split the LangError type into runtime and compile/parse time errors.
This is probably hard given how fuzzy the compile-time vs runtime logic is right now.
A lot of runtime errors that could be compiletime errors are type checking related. These could be evaluated at compiletime by implementing add, subtract, multiplication, etc... to the TypeInfo class and allowing tracking of types through the AST by converting each datatype into a TypeInfo, and performing the logic on it to determine if the types match.
As an example, consider this function:
fn function(value: Number ) -> Number {
let x := value + 1.0
x
}
Under the new typechecking system, it could convert that to something like this:
fn function(value: Number ) -> Number {
let x := value->Number + Float
x->Float
}
Because Number + Float is a Float, returning x should not be possible because the return type is a Number. This should throw a compile time error indicating the type mismatch.
The text was updated successfully, but these errors were encountered:
hgzimmerman
changed the title
Runtime vs CompileTime errors
Runtime vs CompileTime errors (Type System ?)
Oct 8, 2017
hgzimmerman
changed the title
Runtime vs CompileTime errors (Type System ?)
Runtime vs Compiletime errors (Type System ?)
Oct 8, 2017
Possibly split the LangError type into runtime and compile/parse time errors.
This is probably hard given how fuzzy the compile-time vs runtime logic is right now.
A lot of runtime errors that could be compiletime errors are type checking related. These could be evaluated at compiletime by implementing add, subtract, multiplication, etc... to the TypeInfo class and allowing tracking of types through the AST by converting each datatype into a TypeInfo, and performing the logic on it to determine if the types match.
As an example, consider this function:
Under the new typechecking system, it could convert that to something like this:
Because Number + Float is a Float, returning x should not be possible because the return type is a Number. This should throw a compile time error indicating the type mismatch.
The text was updated successfully, but these errors were encountered: