News for hackers. Stuff that matters.
Re:ReasonML: Strict, powerful and forgiving by ungzd on Saturday November 10, 2018 @02:42PM (#18423090)
Is lack of ad-hoc polymorphism a real issue for such projects? Everyone who used JS before are accustomed to using overridden methods, or just duck typing, which are form of ad hoc polymorphism too, but Reason/Ocaml lacks it. How does this feel? Or it's easy to code avoiding ad-hoc polymorphism after forming habit for it? Do you use things like function dictionaries to simulate ad-hoc polymorphism?
Re:ReasonML: Strict, powerful and forgiving by a0 on Saturday November 10, 2018 @05:35PM (#18423896)
In principle it seems like a significant limitation but in practice it is rarely an issue.

ReasonML does support parametric polymorphism so it is still possible to write generic code.

Some language features conveniently help to avoid boilerplate. For example it’s possible to have a `Float` module with arithmetic operators and “open” it like this: `Float.(10.0 + 0.5 / 3.0)`.

There’s also a work in progress project called Modular Implicits that will introduce ad-hoc polymorphism.

Re:ReasonML: Strict, powerful and forgiving by ohadrau on Saturday November 10, 2018 @06:50PM (#18424175)
Even then, I feel like working with Floats vs. Ints in a web browser is almost never an issue. I'd just open Float if I need it because I can't think of any scenario where I'd use both in one module
Re:ReasonML: Strict, powerful and forgiving by int_19h on Saturday November 10, 2018 @10:41PM (#18424915)
I'm not familiar with Reason, but OCaml does have virtual methods and dynamic dispatch, and therefore ad-hoc polymorphism.

http://dev.realworldocaml.org/classes.html#virtual-classes-a...

Now, you can't downcast or cross-cast or do a runtime typecheck easily, but that doesn't mean it's impossible - you just have to use roundabout ways like variants to do so (which also means that you can control which class hierarchies it is available for, and which ones it's not). A class hierarchy combined with an polymorphic variant type to allow runtime type queries can be made as powerful as a runtime typecheck/cast in Java - if more verbose - for those rare cases where you actually need it.

http://dev.realworldocaml.org/variants.html#polymorphic-vari...

Of course, in practice, most cases where you'd use a downcast or a typecheck in a language like Java, map more naturally to regular variants and matching on them in OCaml.

Re:ReasonML: Strict, powerful and forgiving by thangngoc89 on Saturday November 10, 2018 @02:50PM (#18423129)
Actually I like the lacks of it. I know exactly what an operator does without digging deep into the source code. Everything is explicit