On 6/27/23 6:34 PM, 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
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,
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.
In practice, the compiler
Does anyone know why the new variables don't show up after the
static foreach?
I have a struct, it has some marked fields. I want to note those
fields at compile time and make some similarly named fields like
myField becomes myField__replicated.
The code doesn't _have_ to be inside the
On Tuesday, 27 June 2023 at 05:03:01 UTC, Jonathan M Davis wrote:
However, I would point out that getSymbolsByUDA gives you
symbols, not strings, whereas pragma(msg, ...) wants a string.
For some time now, it accepts any number of objects, which will
all be converted to strings and
On Tuesday, 27 June 2023 at 04:25:13 UTC, Chris Katko wrote:
How do I get just the field name?
__traits(identifier, field)
And why does it think this is a run-time value?
It is the same as if you wrote `Class.field`
On Tuesday, 27 June 2023 at 04:56:19 UTC, Ali Çehreli wrote:
On 6/26/23 21:25, Chris Katko wrote:
> How do I get just the field name?
I know .tupleof, which you can typeof() as well:
class myObject{
int field1, field2, field3;
static foreach(field; typeof(this).tupleof)
{
On Monday, June 26, 2023 10:25:13 PM MDT Chris Katko via Digitalmars-d-learn
wrote:
> inside a static foreach I can do
>
> ```
> enum rep;
>
> class myObject{
> int field1, field2, field3;
>
> static foreach(field; getSymbolsByUDA!(typeof(this), rep))
> {
> pragma(msg, field); // fails
>
On 6/26/23 21:25, Chris Katko wrote:
> How do I get just the field name?
I know .tupleof, which you can typeof() as well:
class myObject{
int field1, field2, field3;
static foreach(field; typeof(this).tupleof)
{
pragma(msg, field.stringof);
}
static
inside a static foreach I can do
```
enum rep;
class myObject{
int field1, field2, field3;
static foreach(field; getSymbolsByUDA!(typeof(this), rep))
{
pragma(msg, field); // fails
pragma(msg, fullyQualifiedName!field); // works
}
}
```
error for pragma(msg, field)
```
10 matches
Mail list logo