News for hackers. Stuff that matters.
Re:TypeScript vs. ReasonML by masklinn on Wednesday September 04, 2019 @09:28AM (#20876972)
> Does ReasonML infer that a type "Product" is the only one in the visible namespace with a "name" property

Yes.

> does it infer at use time that the formatName(...) invocation is valid because the argument has a "name" property?

No. OCaml does have a structural object system (https://v1.realworldocaml.org/v1/en/html/objects.html) and it is available to reason, but it's syntactically funky (https://reasonml.github.io/docs/en/object) and as far as I can tell TFA does not use it.

> They're separate concepts.

Yes. Which is why OCaml (and thus Reason) separates it[0] from the nominative "structures".

> Maybe I want to ensure that I'm receiving a product as it makes no sense to invoke formatName(...) on other things with names like a Cat or Person.

You're really deep into this strawmanning thing.

[0] pretty completely, you can't use nominative types in a structural context, they are not compatible. In fact structural types are sets of methods, something which doesn't exist on the nominative side.

Re:TypeScript vs. ReasonML by koolba on Wednesday September 04, 2019 @10:36AM (#20877556)
I didn’t mean it as a straw man. I’m not familiar with ReasonML at all and meant to illustrate the example.