| Thread overview | |||||
|---|---|---|---|---|---|
|
March 10, 2014 Any way to print compile-time generated code? | ||||
|---|---|---|---|---|
| ||||
I'm toying with the dproto library and have encountered an issue where I can't remove items from a "repeated" list of items. I'd like to see what the mixins are producing in terms of actual D code, so that I can figure out how I can correctly try to delete an entry or find the code that's generating the array and add whatever corrections are necessary to expose this ability. Is there any way to push a mixin into a string, instead of into the code, or otherwise to view the output of the "preprocessor"? | ||||
March 10, 2014 Re: Any way to print compile-time generated code? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Chris Williams | Change the mixin(x) line to pragma(msg, x);. It will then print out the generated string at compile time instead of mixing it in so you can take a look at it. | |||
March 10, 2014 Re: Any way to print compile-time generated code? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Monday, 10 March 2014 at 18:25:10 UTC, Adam D. Ruppe wrote:
> Change the mixin(x) line to pragma(msg, x);. It will then print out the generated string at compile time instead of mixing it in so you can take a look at it.
That just gives me an error:
source/app.d(29): Error: Cannot interpret ProtocolBufferFromString!"\x0a message Person {\x0a required string name = 1;\x0a required int32 id = 2;\x0a optional string email = 3;\x0a\x0a enum PhoneType {\x0a MOBILE = 0;\x0a HOME = 1;\x0a WORK = 2;\x0a }\x0a\x0a message PhoneNumber {\x0a required string number = 1;\x0a optional PhoneType type = 2 [default = HOME];\x0a }\x0a\x0a repeated PhoneNumber phone = 4;\x0a }\x0a" at compile time
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply