GithubHelp home page GithubHelp logo

beddalumia / matlab-multiple-dispatch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aminya/dispatch.m

0.0 0.0 0.0 79 KB

Providing julia-inspired multimethods to MATLAB, as suitable function objects. [proof of concept!]

License: Apache License 2.0

MATLAB 100.00%
matlab multimethods multiple-dispatch overloading polymorphism

matlab-multiple-dispatch's Introduction

matlab-multiple-dispatch's People

Contributors

aminya avatar beddalumia avatar

matlab-multiple-dispatch's Issues

Sudden inexplicable under estimation of coverage for `multimethod.interface` [should be 100%, measured 68%]

Codecov reports a quite low coverage of the interface class, specifically complaining about all error handling statements not being reached:

Screen Shot 2022-09-12 at 04 02 43

Screen Shot 2022-09-12 at 04 03 02

Screen Shot 2022-09-12 at 04 03 18

But, from the CI log we have:

Screen Shot 2022-09-12 at 04 05 46

Screen Shot 2022-09-12 at 04 06 06

Which pretty much shows that those lines are covered, specifically in: https://github.com/bellomia/matlab-multiple-dispatch/blob/b8ba9dd7714fbcc98f45e17d293d1ed05873e38c/.test/test_error_handling.m#L8-L14

So what's the matter with those lines? Why does Codecov miss them in the report?

Also note that in just one of the previous commits (bc586fc) the report measured a 100% coverage in interface.m, which should be the correct assessment. So why it stopped working?

Design a way to make easy to extend the method table to a user that has no access to the original dispatch implementation

The current seminal implementation on master is very rusty, of course.
Having the method table defined just as a cell array makes for a trivial
implementation, but not very safe especially as it requires the user to
build a valid table himself. Also if user A builds a library making use
of our multiple-dispatch API and user B wants to import the generic and
then extend it with his own custom methods, he would need access to the
original code by A.
This is more or less what you have in languages with static overloading
but Julia does neatly better, allowing powerful and pervasive reuse and
composability.

I wonder if we should build a method_table / methods / interface / class
that encapsulates a safe (set of) constructor(s) for the table, the
generic function handle and the dispatch function itself. Then the class
could be imported by both user A and user B, so to allow A to define his
generic fA object and specialized methods in his own library and B to
extend such object (not the class!) with new method table entries, i.e.
his own specializations. This would effectively allow easy inter-library
composability. Also, B could either extend the actual object provided by
A or just his own copy, which would arguably be safer.

I can't foresee now all the possible pitfalls, I guess we could just try…

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.