What is dynamic object dispatch?

In the official documentation, there’s a paragraph describing ReScript.

ReScript covers only a curated subset of JavaScript. For example, we emphasize plain data + functions over classes, clean pattern matching over fragile ifs and dynamic object dispatches , proper data modeling over string abuse, etc.

Can anyone tell me where “dynamic object dispatch” is explained?
Is that a kind of runtime polymorphism in Java/C++?

Yes, it’s an OO concept. Classes can inherit from a parent and override methods, and the type system allows instances of the child class to be stored in variables that are the parent type. Thus, calling the method on an object of the parent type might either execute the parent implementation or a child implementation.

http://www.learntoprogramming.com/content/dynamic-method-dispatch

1 Like

Yep. I’m considering changing it to virtual dispatch instead.

I thought it was referring to building objects on the fly to dispatch them to redux

Well someone sure is taking is forum casually lol (Edit: unless you’re not kidding! Oops)

I’ve changed the example to virtual dispatch.

Sorry, I’m a JS dev, and since I was not familiar with the term and with the given context (I was reading about reason react) my mind just used the most familiar thing . But that’s why I am a dev, because I love to keep learning

Ah I see. No, nothing to do with redux. It mostly means dynamically selecting the method to call vs knowing at compile time, yada yada. There are semantic and performance concerns regarding both ways.