On Saturday, 5 October 2024 at 06:35:57 UTC, ryuukk_ wrote:

Why is this allowed
```D

struct EntityDef
{
    struct
    {
        int hp;
    }
}
```


But not this fucking thing?

```D
struct EntityDef
{
    struct
    {
        int hp;
    } stats;
}
```


Let me name my shit


No, i don't want to do:


```D
struct EntityDef
{
    struct Stats
    {
        int hp;
    } Stats stats;
}
```

Repeating the same name 3 times, i should go back to the stone age too no?

C and all other C like languages allow me to be concise

Why is it a D thing to be backward?

It’s the semicolon. As soon as the closing brace, the declaration is over. You would have to invent new syntax.

-Steve

  • Re: Why is this ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
    • Re: Why is ... ryuukk_ via Digitalmars-d-learn
      • Re: Why... Sergey via Digitalmars-d-learn
        • Re:... ryuukk_ via Digitalmars-d-learn
    • Re: Why is ... Salih Dincer via Digitalmars-d-learn
    • Re: Why is ... Steven Schveighoffer via Digitalmars-d-learn
      • Re: Why... ryuukk_ via Digitalmars-d-learn
        • Re:... Steven Schveighoffer via Digitalmars-d-learn
          • ... ryuukk_ via Digitalmars-d-learn
            • ... Steven Schveighoffer via Digitalmars-d-learn
      • Re: Why... Nick Treleaven via Digitalmars-d-learn
        • Re:... ryuukk_ via Digitalmars-d-learn
          • ... Nick Treleaven via Digitalmars-d-learn
            • ... ryuukk_ via Digitalmars-d-learn
              • ... Salih Dincer via Digitalmars-d-learn
    • Re: Why is ... Sergey via Digitalmars-d-learn

Reply via email to