Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

D, Rust, Nim(rod), Template Haskell, OCaml, C++...


I don't think these can open and read .proto files during compilation.


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.


Template Haskell code can runIO I/O actions, including reading files.


Rust can.


Are you referring to compiler plugins like the one providing regex! macro or is it something else?


Yes, compiler plugins. For a relevant example, check out the Rust docopt crate[1].

An identical technique could be used for yacc or protobufs.

[1]: https://github.com/docopt/docopt.rs


Haskell can, but there is not an implementation that does this.


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).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: