Skip to main content

Questions tagged [static-typing]

For questions relating to languages whose variables' data types are known at compile time, and type systems supporting this.

15 votes
1 answer
513 views

What are some options for integrating subtyping with Damas-Hindley-Milner inference?

Type inference in a Damas-Hindley-Milner type system with subtyping is known to be undecidable in general. What makes it so difficult? What options are there to get around undecidability which could ...
6 votes
1 answer
125 views

Understanding the "operational" reading of typing judgements in PFPL by Robert Harper, Chapter 4 Statics

I'm reading Practical Foundations for Programming Languages by Robert Harper and am confused by the exercises in Chapter 4, "Statics", where he discusses a (monomorphic) type system. The ...
1 vote
1 answer
331 views

Type-checking Python vs Typescript

mypy is very slow, pyright is fast but not quick enough in a large codebase, and tsc gives an immediate intellisense and type errors. I do not know whether it is because Python has more complex type ...
15 votes
6 answers
5k views

"Testing" that something does not compile in metaprogramming

Use case Some languages offer techniques to ensure certain requirements at compile time. For example, rust has the NonZeroU32 type that will ensure at compile time ...
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 ...
9 votes
5 answers
1k views

How to make logical operators that return operands consistent in a statically typed language?

In C++, 3 || 4 returns true. But in Python, 3 or 4 returns 3 instead. That's a logical operator that returns its operand. I don'...
19 votes
4 answers
3k views

To what extent is type theory relevant to dynamically typed languages?

There seem to be two conflicting views regarding the status of "type systems" used in dynamically typed languages: That dynamically typed languages are actually just unityped static ...
11 votes
1 answer
444 views

How can I have mutually-exclusive properties in a structural type system?

I have a structurally-typed object-oriented language, and I'd like to allow for types with some mutually-exclusive properties/attributes/slots/methods. That is, an object having more than one of these ...
8 votes
1 answer
366 views

How, if at all, do kinds fit into the type universe hierarchy?

As I understand it, as a (value-level) function f that takes a value x of type T and returns ...
3 votes
2 answers
422 views

What are the possible variations of the type of "this" or "self"?

In the class definitions of an object oriented language, this refers to the object instance the code is about to work upon. Naturally, it should have the same type ...
26 votes
6 answers
1k views

Why don't many languages have integer range types?

An integer range type like 0..100 means that a value can be any integer in that range. Arithmetic operations on range types produce other range types, for example ...
9 votes
4 answers
634 views

What are the pros and cons of static typing?

Static typing means the type of a variable is known at compile time. This means that either you have to specify the type, or the compiler has to infer it (usually both). You also can't change the type ...
10 votes
1 answer
207 views

How can optional properties be made sound in a static structural type system?

Typescript's structural type system is known to be (intentionally) unsound, in the sense that the value of an expression at runtime is not always necessarily assignable to its type determined at ...
11 votes
3 answers
316 views

How can a language statically ensure a required index exists in a list?

Suppose a language has a conventional list data structure that contains some dynamic number of values indexed sequentially. Some operations to access a value from the list require that a certain index ...
4 votes
1 answer
170 views

Supporting a statically-typed language in an IDE?

I'm almost finishing my open-source language's verifier. It performs parsing and verification, which ensures a set of programs are valid both syntatically and semantically at compile-time. To start ...

15 30 50 per page