uwescience / raco

Compilation and rule-based optimization framework for relational algebra. Raco is the language, optimization, and query translation layer for the Myria project.
Other
72 stars 19 forks source link

Rewrite repr things (ie the Algebras) with ADTs #456

Open bmyerz opened 9 years ago

bmyerz commented 9 years ago

We currently have very strict rules about Algebra classes, such as repr that can be used to construct the object, and yet we write the same code over and over for each new operator. MacroPy has algebraic data types to avoid much of this.

https://github.com/lihaoyi/macropy#case-classes

While writing an overly complicated rule match and hating it, I came across macropy. The second benefit of these macros is that you can do case pattern matches, which would simplify and better-document the checks of rules. Find any compiler/interpreter written in a functional-friendly language like OCaml or Scala and you'll see pattern matching on algebraic data types.

bmyerz commented 9 years ago

Limitations in case classes: https://github.com/lihaoyi/macropy#limitations

in particular,