Live data from Hacker News

Ask HN: Is there any programming language with a Physics-like dimensional types?

news.ycombinator.com

1–4 of 4 posts

Ask HN: Is there any programming language with a Physics-like dimensional types?

#1
I am curious if there is a programming language with a type system that would cater to types in Physics?

For example, I could say:

  deftype distancd from double;
  deftype time from double;
  deftype speed from distance/time;
  deftype acceleration from speed/time;

  distance d = 10.5;
  time t = 1.2;
  speed s = d/t; // okay
  acceleration a = d/t/t; // okay
  acceleration b = d/t; // error
Is there any programming language type system that supports this idea?