funsor icon indicating copy to clipboard operation
funsor copied to clipboard

Replace __call__-only FunsorMeta subclasses with a _fill_defaults method

Open eb8680 opened this issue 4 years ago • 0 comments

A number of funsor.terms.Funsor subclasses include custom metaclasses derived from FunsorMeta that only implement __call__ and whose only purpose is to fill in default values of optional arguments and convert them to funsors.

In the interest of simplifying Funsor code conceptually and making it easier to onboard new contributors, it would be good to replace these metaclasses where possible with a new classmethod _fill_defaults of Funsor subclasses that serves the same purpsoe and is invoked in FunsorMeta.__call__.

List of cases:

  • [ ] NumberMeta
  • [ ] SubsMeta
  • [ ] SliceMeta
  • [ ] CatMeta
  • [ ] ResultMeta in funsor.factory
  • others?

eb8680 avatar Sep 28 '20 17:09 eb8680