Skip to main content

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
3 votes
0 answers

How to implement type checking of generics?

I am implementing a toy language, for learning. As of now, it has a Rust-like syntax and I would like to implement monomorphization of Generic types. After parsing, I have an Abstract Syntax Tree. Now,...
Jonas's user avatar
  • 304
9 votes
1 answer

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

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
  • 1,017
10 votes
3 answers

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,083
12 votes
3 answers

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,083
14 votes
1 answer

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
  • 241
16 votes
5 answers

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,924
6 votes
1 answer

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
  • 13k
4 votes
1 answer

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
  • 705
15 votes
5 answers

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
  • 705
14 votes
2 answers

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
  • 9,067
4 votes
1 answer

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

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,843
5 votes
3 answers

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,723