From my past C experience I had developed a distaste for clever pre-processors tricks that a lot of people love showing around.
However while easing myself into typed languages after multiple years of using ruby and erlang exclusively, I have found myself needing a pre-processor to eliminate the boilerplate often required to satisfy type systems. In addition I wanted to create a project to generate type definitions (and associated tests) for multiple languages (esp. Typescript, bucklescript and Nim) having js targets for library authors.
The approach I settled in was a very simple template driven pre-processor that would inject the generated code right into the source files between annotated comment directives. I expect this, along with an explicit focus on non-composability, to discourage people from using templates where normal language features would do just as well.
However while easing myself into typed languages after multiple years of using ruby and erlang exclusively, I have found myself needing a pre-processor to eliminate the boilerplate often required to satisfy type systems. In addition I wanted to create a project to generate type definitions (and associated tests) for multiple languages (esp. Typescript, bucklescript and Nim) having js targets for library authors.
The approach I settled in was a very simple template driven pre-processor that would inject the generated code right into the source files between annotated comment directives. I expect this, along with an explicit focus on non-composability, to discourage people from using templates where normal language features would do just as well.
This project (written in typescript) is available at https://github.com/lorefnon/InGenR and any feedback and contributions are welcome.