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

Basile B. b2.temp at gmx.com
Fri Jan 26 12:55:17 UTC 2018


On Friday, 26 January 2018 at 11:32:42 UTC, Mike Parker wrote:
> 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

LOL, all do that: https://imgur.com/a/UoHpz.


More information about the Digitalmars-d-learn mailing list