Jump to content
  • Advertisement
Sign in to follow this  
Scarabus2

Compound assignment ops on property accessors

This topic is 3209 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Any chance of seeing compound assignment operators working with property accessors? Maybe where "object.property += value;" is transformed by the engine into a get, the operation and a set: "object.property = object.property + value;" The reason I ask is because I'm in a position where I'm forced to use property accessors with some of my main classes. They have definitely helped me solve some important issues with my engine's script interface but I still think having to "unwrap" x += y to x = x + y is a bit unwieldy, especially with more complex expressions. Not to mention having to explain the difference between members and properties to the users of my software.

Share this post


Link to post
Share on other sites
Advertisement
I'll do what I can to improve the support for compound assignment with property accessors, however the problem is that having the compiler automatically 'unwrap' the complex expressions may have negative impact on the result of the script which may cause difficult to find bugs, not to mention unexpected performance hits.

Where the property accessor is on a reference type it should be possible to have the compiler keep a reference to the object so that the get/set accessors can be called on the same object without having to re-evaluate the whole expression. On non-reference types this may not be possible, and I may still have to prohibit this.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!