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

F# use the same + operator

  > 1.0;;
  val it : float = 1.0

  > 1;;
  val it : int = 1

  > 3.0 + 1.0;;
  val it : float = 4.0

  > 3 + 1;;
  val it : int = 4
or strings

  > "3" + "4";;
  val it : string = "34"
implicit conversion is not supported (good ihmo)

  > 3.0 + 1;;

  3.0 + 1;;
  ------^

  stdin(5,7): error FS0001: The type 'int' does not match the type 'float'


I'd be fine with that. The OCaml way just seems needlessly preachy.




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

Search: