-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incorrect type expressions for type-specific Property subclasses #268
Comments
Proposed fix pushed, please review. |
Type expressions are also unnecessary in cases like this: // @public {BooleanProperty} - whether the wave area graph should be displayed
this.showGraphProperty = new BooleanProperty( false ); .. for the same reason that they are unnecessary for: // @private
this.eventTimer = new EventTimer( eventTimerModel, timeElapsed =>
this.advanceTime( 1 / EVENT_RATE, false )
); ... it's obvious what the type is. |
Should I omit {number}? // @public {number} phase of the wave generator
this.phase = 0; What about Property enums? // @public {Property.<PlaySpeedEnum>} - the speed at which the simulation is playing
this.playSpeedProperty = new Property( PlaySpeedEnum.NORMAL, {
validValues: PlaySpeedEnum.VALUES
} ); What about parametric Property instances? // @public {Property.<Scene>} - selected scene
this.sceneProperty = new Property( this.waterScene, {
validValues: this.scenes
} ); |
I removed more cases where the type is obvious, wasn't sure about the cases mention in the preceding comment. @pixelzoom can you please review? |
The rule of thumb that I use is "include type expression unless the type is obviously identified in the definition". And I think this is something to keep in mind for the future, not to change retroactively. It doesn't hurt anything to have redundant type expressions. That said...
I think it's fine to omit
The type of the Property's value is identified in the definition, it's obviously
The type of the Property's value is NOT identified in the definition. You'd have to look elsewhere (at the definitions of |
Thanks, I used the aforementioned rules of thumb to prune redundant annotations further. Ready for review. |
👍 Closing. |
Noted in code review #259.
Using
{Property.<boolean>}
,{Property.<number>}
, and{Property.<string>}
is generally:(1) ... unnecessary. In these cases you should be (and are) using
BooleanProperty
,NumberProperty
, andStringProperty
respectively.(2) ... incorrect, because the Property subclasses add functionality to Property. E.g.:
... is incorrect, because
NumberProperty
has more functionality than{Property.<number>}
.The text was updated successfully, but these errors were encountered: