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

It not exotic at all, plenty of languages outside C++ family branch use [] for type parameters.

In fact, I think D is the only one using () as well.



D uses "()" for type declaration and "!()" for instantiation:

  template TCopy(T)
  {
      void copy(out T to, T from)
      {
          to = from;
      }
  }

  /* … */

  int i;
  TCopy!(int).copy(i, 3);
The parens can also be omitted in some cases.




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

Search: