On Wednesday, 6 February 2013 at 02:08:47 UTC, John Colvin wrote:
On Tuesday, 5 February 2013 at 19:50:06 UTC, Zach the Mystic wrote:
On Tuesday, 5 February 2013 at 18:58:23 UTC, John Colvin wrote:
On Tuesday, 5 February 2013 at 00:23:42 UTC, Zach the Mystic wrote:

Smash.

I'm no expert but this is appears a quite comprehensive solution. I like the emphasis on improving the underlying mechanisms of the language (i.e. structs) in order to facilitate the special case (properties).

Anyone else care to comment?

I love you.

Why thank you!

I think the title of this thread might be preventing it getting the attention it deserves unfortunately.

Actually, it did receive some attention from Andrei after a brief exchange of posts between him and me. Here's the page:

http://forum.dlang.org/thread/[email protected]?page=21

At first I was upset.

Then I responded in greater detail.

There's a degree to which the phase of development D is in seriously affects the developers' willingness to try new things. And the concern that some dark corner of the suggested enhancements will limit their usefulness is certainly legitimate. For my part, I'm ready to commend the fate of this proposal to a higher power, be it human or divine.

But before I go, I want to say one brief thing. The last item I considered when analyzing how nested structs should work was how functions could inherit the needs of the nested functions they called. Because I didn't even realize the power of my own feature, I didn't fully utilize it when I wrote the example.

Here is the final version of Sparky(™) using the full power of nested structs:

Dog sparky;
struct Dog {
  Brain brain;
  struct Brain
  {
    bool asleep = false;
    void think() {
      if(!asleep) {
        // Sparky has truly advanced A.I. and will stop
        // any intruder so long as he is awake
      }
    }
  }
  Body bodi;
  struct Body
  {
    bool broken = false;
    Bladder bladder;
    struct Bladder {
      void release() {
        // An absolutely fascinating implementation
      }
    }
    Tail tail;
    struct Tail {
      int wagSpeed = 0;
      void wag() {
        ++wagSpeed;
        if (wagSpeed >= 7) wagTheDog;
      }
      void wagTheDog()
      {
        wagSpeed = 0;
        broken = true;
        bladder.release;
        brain.asleep = true;
      }
    }
  }
  void jolt() { bodi.tail.wag; }
}

Reply via email to