Re:Go generate: A proposal for a Go preprocessor
by mseepgood on Saturday September 27, 2014 @09:43AM
(#8376996)
I don't think these can open and read .proto files during compilation.
[ Parent
| on HN ]
Re:Go generate: A proposal for a Go preprocessor
by pjmlp on Saturday September 27, 2014 @10:05AM
(#8377043)
D has meta-programming and compile-time evaluation, including reading files.
I bet C++ can do it with some clear use of template metatprogramming, compile time evaluation and processor macros.
Nim has meta-programming capabilities, including reading files.
Not sure about Template Haskell, though.
Re:Go generate: A proposal for a Go preprocessor
by thesz on Saturday September 27, 2014 @01:47PM
(#8377662)
Template Haskell code can runIO I/O actions, including reading files.
Re:Go generate: A proposal for a Go preprocessor
by pcwalton on Saturday September 27, 2014 @09:44AM
(#8377005)
Rust can.
Re:Go generate: A proposal for a Go preprocessor
by tuxychandru on Saturday September 27, 2014 @01:28PM
(#8377606)
Are you referring to compiler plugins like the one providing regex! macro or is it something else?
Re:Go generate: A proposal for a Go preprocessor
by wycats on Saturday September 27, 2014 @02:48PM
(#8377825)
Yes, compiler plugins. For a relevant example, check out the Rust docopt crate[1].
An identical technique could be used for yacc or protobufs.
Re:Go generate: A proposal for a Go preprocessor
by jeremyjh on Saturday September 27, 2014 @10:28AM
(#8377095)
Haskell can, but there is not an implementation that does this.
Re:Go generate: A proposal for a Go preprocessor
by hawkice on Saturday September 27, 2014 @01:28PM
(#8377605)
To be clear for the Haskell newbies, he's talking about an implementation of the protobuf library, not Haskell. You can fairly easily lift from Template Haskell types into IO in GHC (not sure about TH in other compilers).