Is it possible to obtain textual representation of an arbitary code?

Mike Parker aldacron at gmail.com
Fri Jan 26 11:32:42 UTC 2018


On Friday, 26 January 2018 at 11:18:21 UTC, Oleksii Skidan wrote:

>
> I could imagine a mixin-based solution in D:
> ```d
> // Usage:
> ASSERT!"a == b";
> ```
> But it seems a bit alien to me. First of all, it kind of 
> stringly-typed one. Secondly, neither IDEs nor advanced text 
> editors are able to figure out that the string contains actual 
> D code, and so neither syntax highlighting nor code assistance 
> work with this approach.

Token strings are intended for this and editors *should* 
highlight them (don't know if any currently do):

https://dlang.org/spec/lex.html#token_strings


More information about the Digitalmars-d-learn mailing list