Hacker News new | past | comments | ask | show | jobs | submit login

The community tends to shy away from classes, but using a method for to_string accomplishes your second point in a minimal way.

  let to_string stringer : string = stringer#to_string
  val to_string : < to_string : string; .. > -> string = <fun>

I think there's also plenty of people who feel just as strongly about Reason syntax in the other direction.



I'm not particularly attached to Reason syntax myself, but there are some bits of OCaml syntax that do annoy me, such as the right-to-left direction for parametrized types ('a list instead of a more usual list 'a).

As for classes, well... They're not really used outside of specific situations (eg, UI widgets), so it's not really a terribly convenient solution (especially since, for a really useful to_string implementation, you would want the member fields of your class to also implement to_string, so that would mean objects everywhere).




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: