News for hackers. Stuff that matters.
Re:Go generate: A proposal for a Go preprocessor by zuzun on Saturday September 27, 2014 @08:14AM (#8376807)
So how many programming languages besides LISP are powerful enough to support turning Protocol Buffers into code during compilation? And is this the ultimate must have?
Re:Go generate: A proposal for a Go preprocessor by logicchains on Saturday September 27, 2014 @09:09AM (#8376915)
It could be done in OCaml or Haskell, considering they both have compile-time AST generation/manipulation, but I'm not sure if anyone's written an actual implementation of this. Nimrod too, as that has AST macros. As does Elixir.
Re:Go generate: A proposal for a Go preprocessor by pjmlp on Saturday September 27, 2014 @09:36AM (#8376971)
D, Rust, Nim(rod), Template Haskell, OCaml, C++...
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.
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.

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

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).
Re:Go generate: A proposal for a Go preprocessor by ben0x539 on Saturday September 27, 2014 @11:36AM (#8377276)
F# type providers sound like they're for this sort of thing. I expect Scala has a similar macro facility. Nemerle can probably do it too.
Re:Go generate: A proposal for a Go preprocessor by NateDad on Saturday September 27, 2014 @01:20PM (#8377576)
I don't want my language to be that complicated. "Powerful" has nothing to do with it.