biaslab / ForneyLab.jl

Julia package for automatically generating Bayesian inference algorithms through message passing on Forney-style factor graphs.
MIT License
148 stars 35 forks source link

Remove antipatterns #82

Open ThijsvdLaar opened 4 years ago

ThijsvdLaar commented 4 years ago

This blogpost from Lyndon White mentions several antipatterns for Julia code: https://white.ucc.asn.au/2020/04/19/Julia-Antipatterns.html (thanks @bauglir for pointing this out). Some of the antipatterns mentioned here are also present in the FL code.

  1. The most prominent one is the over-constraining of argument types. Some very specific constraints are needed for the update rules, but in other places the constraints need not be as strict as they are now;

  2. There are also still some Dicts that should be NamedTuples;

  3. We could make more efficient use of Julia's type inference system to get rid of the matches functions that are used for update rule-matching.

  4. Macros, e.g. @symmetrical can be improved for clarity

ThijsvdLaar commented 4 years ago

Dmitri will propose an improvement to 4)