Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1787

Is Obj being deprecated in its entirety?

$
0
0

The semantics of Obj.t is close to JavaScript’s Object, which is actually the top type. So the belief that unknown is safer than Obj.t is a myth, because there’s very little the compiler can do about top types.

If it’s something for logging or display, it’s better to convert to JSON.t (or BSON.t in your case) early, because it really should be serializable.

In all other cases, it’s better to box values ​​early, or to coerce at least your own abstract type. There’s no good reason to turn a well-known type into “unknown”.


Viewing all articles
Browse latest Browse all 1787

Trending Articles