Questions tagged [type-checker]

For questions about type checkers or type checking, a process in a compiler or interpreter to ensure that values of the correct types are being used where they are expected.

Filter by
Sorted by
Tagged with
9 votes
1 answer
2k views

Is Epic Games' Verse gradually typed?

I've just watched an interview on YouTube with Simon Peyton Jones where they talk about Epic's Verse language. Here (at roughly 51:30) they start talking about the type system. Simon mentions that ...
Timo's user avatar
  • 193
2 votes
1 answer
204 views

Generic method: type inference

I am developing a verifier for the ActionScript 3 language and I have gone through implementing one before for my personal language. I had a type inference limitation with the following construct: <...
Hydroper's user avatar
  • 909
9 votes
3 answers
2k views

Is a unification algorithm overkill for local type inference?

I'd like to create a type system similar to the one in Swift or Kotlin, where you have top-level functions that declare their parameters and return types, but you have some type inference with local ...
Rob N's user avatar
  • 1,073
12 votes
3 answers
2k views

Is type checking usually preceded by a pass that looks at just names and declarations?

Let's say I've parsed a file of code into an AST, and now I want to walk the AST and type check it. My AST nodes have a signature like this (C++) ...
Rob N's user avatar
  • 1,073
8 votes
0 answers
158 views

Extending Hindley Milner with (mutual) recursion

What's a good approach for extending Hindley Milner with mutual recursion without de-sugaring to let+fix+records? My thinking is (assuming no polymorphic recursion) Collect mutually recursive lets ...
aindurti's user avatar
  • 181
15 votes
5 answers
2k views

What are some techniques for faster, fine-grained incremental compilation and static analysis?

An incremental compiler is one which only needs to recompile the parts of a program which changed since the last output, as opposed to a batch compiler which must re-compile everything. Incremental ...
tarzh's user avatar
  • 3,414
6 votes
1 answer
243 views

How do you implement a structural subtyping checker?

In a structurally-typed language, one type is a subtype of another iff it has all of the fields/methods of the other with compatible types, meaning that field or return types are subtypes, parameter ...
Michael Homer's user avatar
  • 11.7k
4 votes
1 answer
128 views

How the compiler or runtime handles types which are complex patterns or have complex constraints?

Pattern Types I am coming from JS/Ruby-land, where in Rails you have things like validation that a string field on a data model matches the IP address regex, for example: ...
Lance's user avatar
  • 695
15 votes
5 answers
3k views

Do you need an "Any" type when implementing a statically typed programming language?

As per the comment about Swift having an Any type here (and my related question in that post, on how to access type metadata at runtime without increasing the ...
Lance's user avatar
  • 695
14 votes
2 answers
1k views

How to prevent undecidable type systems?

Some languages have type systems complex enough to embed undecidable problems in the type system. This famous post details implementing a Turing-complete language in Rust's type system, and Swift's ...
Bbrk24's user avatar
  • 8,857
4 votes
1 answer
154 views

Algorithm for type resolution without forward declaration

I'm trying to find an algorithm/data structure behind type resolution without forward declaration. Something a little bit like this in Java: ...
Clément Jean's user avatar
5 votes
1 answer
190 views

How can we express type theory in a programming language?

Some would say type theory is fundamental to programming. A programming language implementation typically expresses a single type theory through its type system. Are there any specific features a ...
Bruce Adams's user avatar
  • 2,793
5 votes
3 answers
182 views

How can I reconcile “all functions are variables” with a typeclass type system?

In my WIP language, all functions are really just variables with a callable type. That is, a function call foo(bar) is parsed into the following AST: ...
Seggan's user avatar
  • 2,603