Inline imports redivivus

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Mar 9 01:15:47 UTC 2022


On Tue, Mar 08, 2022 at 03:25:49PM -0800, Ali Çehreli via Digitalmars-d wrote:
> On 3/8/22 14:28, Paul Backus wrote:
> 
> > There's always strings:
> 
> And they are the eyesore! :)
> 
> >      bitfields!("int x : 8",
> >                 "int y : 8");
> 
> But you give me the idea that if we allow "this template parameter is
> a string" and don't require strings at the use site, then it would
> work for the above case as well. Basically, the string is contains my
> domain specific language as you show and I can do anything I want with
> it.
[...]

Token strings are your friend:

	bitfields!q{ int x:8; int y:8; };

Or, if you like struct-like syntax:

	bitfields!q{
		int x:8;
		int y:8;
	};


T

-- 
Questions are the beginning of intelligence, but the fear of God is the beginning of wisdom.


More information about the Digitalmars-d mailing list