0

The Zig Programming Language promotes the concept that "types are values" which seems like a very powerful concept to me and I wonder what other programming languages support this concept.

I know that for example C++ templates can be used to pass types to a function but types are still different from values in C++.

eyelash
  • 3,197
  • 25
  • 33
  • 2
    This is a really interesting question, but since it doesn't have a single, definitive, factual answer (there are lots of languages that let you work on types in different ways), I suspect that this isn't a good fit for Stack Overflow. However, I hope that you get some good answers to help guide you! – templatetypedef Jun 23 '19 at 22:07
  • [Idris](https://www.idris-lang.org/) is another statically typed language with first-class types. – eyelash May 31 '20 at 07:48

1 Answers1

4

Most scripting languages have this, such as: Python, Perl, Ruby, JavaScript, Lua. It's less common with ahead-of-time compiled languages, such as C, C++, Rust, Go.

This feature is commonly called "first-class types", as seen by this other question: What is a "First Class" type?

andrewrk
  • 30,272
  • 27
  • 92
  • 113