Git Product home page Git Product logo

provider's Introduction

provider

CI Status Coverage Status Deploy Doc Status

Introduction

Provider is an OCaml library for creating Traits and Interfaces. It allows you to define the functionality needed by a library without committing to a specific implementation.

In essence, Provider handles dynamic dispatch, where the target of a function call is not known until runtime. This is particularly useful in situations where there are multiple ways to provide a certain functionality, and the choice of provider is determined by the end user.

This library started as an experimental project that extracted a pattern featured in the Eio project. The goal was to make this pattern reusable in other projects.

Documentation

Published here.

Rationale

The rationale for this design is detailed in the Eio documentation.

Implementation

At its core, a provider is just a pair consisting of an internal state and a virtual-table of first-class modules operating on that state. This allows dynamic dispatch, but for example doesn't include open recursion or inheritance in its execution model. This design offers an interesting balance between object-oriented and modular programming.

Experimental Status

Please note that this library is still considered experimental. The aim is to gain experience and feedback regarding whether this pattern can have larger applications outside of the scope of Eio.

License

This project is licensed under the ISC license, the same as the original Eio project.

Acknowledgements

We're very thankful to:

  • The Eio developers for their work on the Eio project and for the documentation they published on the rationale for the design of the Eio.Resource module, which was the foundation of the Provider project.
  • The diataxis approach to technical documentation, which we use as inspiration to structure our doc.

provider's People

Contributors

mbarbin avatar

Watchers

 avatar

provider's Issues

Naming: Class vs Trait vs ?

I'm afraid the currently used name Class is going to be confusing as terminology for this project.

I wonder if there are alternatives that would make sense. For example Trait?

To be continued.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.