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

Reasoning about "inheritance"

$
0
0

Then you can use mixins for simple cases. The only difference is that there is no implicit dispatch table and you manage it yourself.

module Circle = {
  include Shape

  let method = () => {
    let _ = Shape.method // you can override
  }
}

But as this gets messy quickly, I’d follow the wisdom of our predecessors. Composition over inheritance


Viewing all articles
Browse latest Browse all 2592

Trending Articles