top | item 36777701

(no title)

jelambs | 2 years ago

We recently built our own codegen solution to automatically create, maintain, and document our backend SDKs so that we didn’t have to compromise on either quality or maintenance burden. Also see part one of the series where we discuss how compiler theory inspired our solution: https://stytch.com/blog/what-does-compiler-theory-have-to-do...

discuss

order

verdverm|2 years ago

Interesting take on code gen. We went the way of declarative -> text/template (Go vs jinja in python), but use CUE as the input. Here, we can do many of the things that you implement in the translations and hybrid method.

We actually used to do something similar, but were able to remove tons of code and move that to the user layer so they can control, because each language has its own patterns and snowflakes. Basically lift the DSLs, transforms, and templates out of the implementation. CUE also provides some really powerful building blocks for schemas, aggregations, and defaults, while also reducing how much we have to write as humans.

https://github.com/hofstadter-io/hof

jelambs|2 years ago

Thanks for sharing! We had a slightly different cost/benefit analysis for our use case with fairly straightforward APIs but know that might not be the same for everyone.