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.

6 votes
1 answer
124 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 ...
Jay Lee's user avatar
  • 223
1 vote
1 answer
322 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 ...
mq7's user avatar
  • 113
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 ...
mousetail's user avatar
  • 8,499
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
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'...
user23013's user avatar
  • 2,548
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 ...
Caleb Thomas's user avatar
3 votes
2 answers
416 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 ...
user23013's user avatar
  • 2,548
8 votes
1 answer
363 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 ...
user570286's user avatar
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 ...
kaya3's user avatar
  • 20k
13 votes
1 answer
460 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 ...
Pseudonym's user avatar
  • 4,981
4 votes
1 answer
169 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 ...
Hydroper's user avatar
  • 1,017
11 votes
3 answers
314 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 ...
Michael Homer's user avatar
  • 13.1k
13 votes
5 answers
406 views

What strategies did Go use to circumvent the lack of generics?

Go (was) famous for its lack of generics. However, the lack of generics in a statically typed language makes quite a few things harder. For example (in a pseudocode because I don't know Go): ...
Seggan's user avatar
  • 2,743
12 votes
4 answers
1k views

Why does Python ignore type hints?

In Python, everything is treated as an object. This means that CPython interpreter will decide on the fly, what is the type of each variables or the function return type depending on the current state....
Hemanth Haridas's user avatar
11 votes
1 answer
439 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 ...
Michael Homer's user avatar
  • 13.1k

15 30 50 per page