ExtendRealityLtd / Malimbe

[Obsolete - No longer maintained] A collection of tools to simplify writing public API components for the Unity software.
MIT License
51 stars 11 forks source link

Allow [SetsProperty] method to have different signatures #20

Closed bddckr closed 5 years ago

bddckr commented 5 years ago

This is an enhancement to PropertySetterMethod.

The allowed signatures that make sense are:

Still need to decide whether this makes sense and which of these to support.

bddckr commented 5 years ago

Run this annotated method ...

One could argue all of these needs can be reduced to Run this method, and given its signature pass in some values or use the returned value as the value to set the property to. That gives all the needed flexibility as long as all signatures are supported.

The method would be annotated with [CalledBySetter(nameof(thatProperty))] and would first only support a subset of all signatures and later, via another ticket, all of them will be supported.

bddckr commented 5 years ago

I'm reducing the scope of this task down to only support a single method signature, namely void MethodName(T previous, ref T new). The weaver should remember the previous value at the start of the setter method, then call the annotated method at the end of the setter.

This allows all use cases and only has a single downside to it in case one only needs a specific value or none even: You are forced to use that single supported method signature. This doesn't seem like a big issue after all and in case it is a new issue can be raised for it in the future.

ExtendReality-Bot commented 5 years ago

:tada: This issue has been resolved in version 8.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: