That's basically what I have done, and it's both pretty declarative (although not fully) and statically typed.
If you are interested, take a look at https://github.com/cosmos72/gomacro/blob/master/example/make_fibonacci.gomacro and the file it generates when executed by gomacro in preprocessor mode: https://github.com/cosmos72/gomacro/blob/master/example/make_fibonacci.gomacro_output On Saturday, April 28, 2018 at 10:25:06 AM UTC+2, Louki Sumirniy wrote: > > I can think of many uses for macros, so it's a good thing though I will > never use a language that compiles to Go because I like static typing. It > would be a logical next step to implement by-default reflection and dynamic > typing. But I don't see the benefit. Go's whole schtick is about how it's > static typed, and uses an implicit build system based on the structure of a > repository filesystem. People choose it because of these two things. > Newbies stuck in mindsets taught by dynamic typing and OOP and FP languages > struggle with Go and don't realise that providing these features goes > counter to the whole point of the language. > > I think a good direction, however, would be a code generator, and a > declarative syntax for this, to speed up prototyping, and macros are an > important first step towards that. > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.