News for hackers. Stuff that matters.
Re:Becoming an F# contributor by pjmlp on Friday December 12, 2014 @05:27AM (#8739374)
> Then again, it's a very liberal language, if the end of the spectrum is Haskell. It allows side effects and mutable variables.

Like the majority of ML languages. Haskell is pretty special here, being the descendant of Miranda.

Personally I think ML languages of OCaml branch are better for the general programmer public, as the entry level is a lower.

Re:Becoming an F# contributor by moron4hire on Friday December 12, 2014 @07:50AM (#8739723)
How do you feel about having a different set of operators for integers and reals? Like "+." versus "+".
Re:Becoming an F# contributor by enricosada on Friday December 12, 2014 @08:38AM (#8739889)
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'
Re:Becoming an F# contributor by moron4hire on Friday December 12, 2014 @10:02AM (#8740322)
I'd be fine with that. The OCaml way just seems needlessly preachy.
Re:Becoming an F# contributor by pjmlp on Friday December 12, 2014 @12:31PM (#8741431)
I don't have any issue with them.

My first contact with functional programming was with Caml Light back in 1996, OCaml's predecessor, which already has them.

My favourite programming languages are strong typed (e.g. Ada), so I guess it just felt natural back then.

However F# is the favourite one as nowadays I spend most of my time on Windows.

Re:Becoming an F# contributor by FraaJad on Friday December 12, 2014 @08:21AM (#8739811)
how to you feel about the overloaded use of `=` in C?
Re:Becoming an F# contributor by moron4hire on Friday December 12, 2014 @08:34AM (#8739872)
I'm not sure I understand what you mean. `=` is only assignment in C (or Java, or C#, or most any language I know of). `==` is comparison, being a different operator, one wouldn't say `=` is "overloaded".

Two different operations, two different operators. Yes, C famously makes it easy to miss the extra `=` in if expressions, but that's C specifically, and it's not the fault of the operator, that's actually the fault of automatic conversions from int to bool. Static languages designed after I was born usually require boolean expressions in their `if` statements explicitly.

But `+` and `+.` are the same operation. Or are you saying that adding integers and adding reals are not the same operation, and thus warrant separate operators?

Re:Becoming an F# contributor by gnuvince on Friday December 12, 2014 @09:53AM (#8740271)
I've begun to like having '+' and '+.' operators in OCaml. Not that I'm never tripped up, I often am, but I can never hide implicit conversions.

Another thing to consider is how you would implement having '+' for both integers and floats. In a language like C, '+' is designed for its numerical types, but what if you want to use it for big ints? Or for vectors? In a language like C++ you can overload operators, in Haskell or Rust operators are part of a typeclass or trait respectively; you need to add extra features to the language and the code generated by '+' is no longer a simple iadd or dadd instruction.

OCaml's choice may not be the best one or the most popular one, but I think it works fine.

Re:Becoming an F# contributor by tome on Friday December 12, 2014 @01:14PM (#8741723)
Perhaps you know this, but just for the sake of precision and avoidance of doubt: Haskell numerical operations don't actually do any sort of conversion.
Re:Becoming an F# contributor by amirmc on Friday December 12, 2014 @06:50AM (#8739562)
For those who may be interested in contributing to the OCaml language, the Compiler Hacking Wiki is a good place to start.

https://github.com/ocamllabs/compiler-hacking/wiki

Re:Becoming an F# contributor by fsloth on Friday December 12, 2014 @10:27AM (#8740503)
If I recall correctly I think at some point Ocaml required a paid developer licence to be obtained from Inria. Has this changed or am I just misinformed?
Re:Becoming an F# contributor by amirmc on Friday December 12, 2014 @10:40AM (#8740614)
Not that I'm aware of. AFAIK anyone can submit a patch to OCaml without any hurdles. There is a Consortium that companies can join and they benefit from a different licence. That might be what you're thinking of.

http://ocaml.org/community/support.html#TheCamlConsortiumatI...

Re:Becoming an F# contributor by fsloth on Friday December 12, 2014 @03:09PM (#8742408)
Thanks for the clarification!