Better HN
topnewbestaskshowjobs
Log inSign up

wBI8j2bsb

7 karma · joined Apr 27, 2017 (9y ago) · 1 submissions

Submissions

comment 9y ago · link · parent

This is exactly what C does.

  #include <stdio.h>

  typedef struct { double v; } Celsius;
  typedef struct { double v; } Fahrenheit;

  void
  print_celsius(Celsius temperature) {
      printf("Temperature is %f", temperature.v);
  }

  void
  compile_error(Fahrenheit temperature)
  {
      print_celsius(temperature);
  }
I suspect LLVM will clean this up to plain floats as well.