pragma msg field name?

Chris Katko ckatko at gmail.com
Tue Jun 27 23:19:36 UTC 2023


On Tuesday, 27 June 2023 at 22:34:17 UTC, Adam D Ruppe wrote:
> On Tuesday, 27 June 2023 at 22:20:22 UTC, Chris Katko wrote:
>> 		pragma(msg, t.stringof); // does not see any new fields!
>
> D's declarations are all order-independent, in theory those 
> foreaches are done simultaneously, so it is kinda a race 
> condition.

Thank you, that's what I thought, but then I started adding them 
and there was no warning and I was like "wait... is this 
top-down???"

>
> In practice, the compiler does them in two passes but both 
> based on the same initial state.
>
> Adding stuff and then reflecting over the stuff you add must be 
> done as explicit steps on the outside, like you can make a 
> `struct step1 {}` then `alias step2 = transform!step1;` then 
> `alias step3 = transform_again!step2;` or something.

Okay again makes more sense. The amount of stuff that was "kinda" 
working, plus learning through tiny 3 liner code snippets in 
docs, was making my brain explode a bit.

A constructor/factory pattern for this makes way more sense.

Sometimes it's hard to tell where things are symbolic / 
functional, verses procedural/linear.




More information about the Digitalmars-d-learn mailing list