Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Surely if match type is compile time and there is no subtyping then it is basically a no-op type assert. I.e. it’s like writing (e : t) in ML?

Or is it supposed to allow for some kind of ad-hoc polymorphism like:

  func foo(x) string {
    match type(x) {
      char** : return “an array of strings”
      int : return “a number”
      default : return “not sure”
    }
  }
And this gets transformed into something like:

  func foo(Type x_t, x_t x) string {
    match(x_t) {
      pointer_t(pointer_t(char_t)) : return ...
      ...
    }
  }


Interesting suggestion! Will be sure to add that when I can.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: