What is the current state of new properties?

Hipreme msnmancini at hotmail.com
Sun Dec 18 14:02:39 UTC 2022


I have seen that this has been stalled for quite some time, I 
have been developing the sprite abstraction for my engine and I 
don't want to introduce a Java-like. I have seen that Walter was 
searching for a compelling reason for having it, and I think I 
have one.

For modifying my `x` coordinate from the sprite I have:

```d
float x(float v)
     {
         this.x = v;
         if(isDirty)return;
         float x2 = x+width;
         //Top left
         vertices[X1] = x;
         //Top right
         vertices[X2] = x2;
         //Bot right
         vertices[X3] = x2;
         //Bot left
         vertices[X4] = x;
         return v;
     }
```

This is a non trivial setter that I'm using which is currently 
does a lot or not based on a dirty flag. I dislike using it right 
now because I would need to do:
`sprite.x = sprite.x + 50`. This is very verbose, I could even 
just make `sprite.moveBy(50, 0)` which is less verbose than that, 
but this is so java like and I don't want to back right now. 
Currently my dirty flag is implemented but isn't being used 
because I'm setting it to true every frame as it is not possible 
to use properties like that.


More information about the Digitalmars-d mailing list