Skip to content
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

Rename Emitter's argumentTypes #212

Closed
zepumph opened this issue Jan 16, 2019 · 10 comments
Closed

Rename Emitter's argumentTypes #212

zepumph opened this issue Jan 16, 2019 · 10 comments

Comments

@zepumph
Copy link
Member

zepumph commented Jan 16, 2019

from #182
Since creating Validator this name is not really accurate. Instead @samreid @chrisklus and @zepumph were thinking that it could be argumentValidators or argumentValidatorOptions.

both of those are pretty lengthy, and we don't love the idea of writing those for every emitter in the future. Also ValidatorOptions is more of the proper type that Validator, since it is an array of the options, not type {Validator}

Maybe argValidatorOptions isn't too verbose?

@samreid
Copy link
Member

samreid commented Jan 16, 2019

Since this will be prevalent in client code, we may want to optimize it even further. Perhaps something like validators. We could rename Validator to Validation if necessary.

@zepumph
Copy link
Member Author

zepumph commented Jan 18, 2019

Feel free to edit inline

Naming options for validating:
Validator.validate // the way it is now
Validation.validate

Names for Emitter option:

argumentTypes
argumentValidation
validation
validators
validationOptions

@zepumph
Copy link
Member Author

zepumph commented Feb 7, 2019

Marking for a quick dev meeting issues. What should the option name be for the list of validator options objects that are used to validate each arg. Some examples are above. Here are my favorites.

argValidators
argumentValidators
validators

@samreid
Copy link
Member

samreid commented Feb 7, 2019

validators seems best to me.

@jessegreenberg
Copy link
Contributor

@pixelzoom said this is a list of options, so how about validatorOptions?

Consensus: if we call them validators, then rename Validator to something else.

@pixelzoom
Copy link
Contributor

pixelzoom commented Feb 7, 2019

More 2/7/19 dev meeting notes:

There was more discussion, but we didn't reach a final decision on this.

One proposal was to move Validator.validate to validate.js and Validator.validateOptions to validateOptions.js or isValidator.js. In both cases, rename options params to validator. But what to do about DEFAULT_OPTIONS?

@zepumph Pointed out that isValidator.js would be doing something similar to PaintDef.js, but using a totally different approach. Why?

@samreid samreid removed their assignment Feb 14, 2019
zepumph added a commit to phetsims/wave-interference that referenced this issue Feb 23, 2019
zepumph added a commit to phetsims/build-a-molecule that referenced this issue Feb 23, 2019
zepumph added a commit to phetsims/scenery-phet that referenced this issue Feb 23, 2019
@zepumph
Copy link
Member Author

zepumph commented Feb 23, 2019

Work done:

  • separate out validate function to its own file
  • rename Validator.js -> ValidatorDef.js
  • rename Emitter option argumentTypes -> validators

@pixelzoom will you please review.

zepumph added a commit to phetsims/arithmetic that referenced this issue Feb 23, 2019
@zepumph zepumph assigned pixelzoom and unassigned zepumph Feb 23, 2019
zepumph added a commit to phetsims/twixt that referenced this issue Feb 23, 2019
zepumph added a commit to phetsims/sun that referenced this issue Feb 23, 2019
zepumph added a commit to phetsims/energy-forms-and-changes that referenced this issue Feb 23, 2019
zepumph added a commit to phetsims/scenery that referenced this issue Feb 23, 2019
zepumph added a commit to phetsims/joist that referenced this issue Feb 23, 2019
pixelzoom added a commit that referenced this issue Feb 23, 2019
pixelzoom added a commit that referenced this issue Feb 23, 2019
pixelzoom added a commit that referenced this issue Feb 23, 2019
pixelzoom added a commit that referenced this issue Feb 23, 2019
@pixelzoom
Copy link
Contributor

Looks good. I made 4 commits above, 3 of which are cosmetic. But there was one bug, fixed in 89500ae - Array needs to be handled before other types because Array has a constructor.

Back to @zepumph in case there's anything else to do.

@pixelzoom pixelzoom assigned zepumph and unassigned pixelzoom Feb 23, 2019
@pixelzoom
Copy link
Contributor

The answer to this TODO in ValidatorDef.js is probably "not right now".

47 // TODO: do we need a isValidatorDef function? See https://github.com/phetsims/axon/issues/212

@zepumph
Copy link
Member Author

zepumph commented Feb 23, 2019

Thank you so kindly for the quick review!

The answer to this TODO in ValidatorDef.js is probably "not right now".

You are right, probably so. I'm going to remove that todo, but, especially as part of work done in #204, I think that we will need a predicate soon (something to return a boolean instead of assertions.

zepumph added a commit that referenced this issue Feb 23, 2019
@zepumph zepumph closed this as completed Feb 23, 2019
zepumph added a commit to phetsims/utterance-queue that referenced this issue Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants