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

Validation changes #39

Open
thejohnfreeman opened this issue Jul 10, 2012 · 0 comments
Open

Validation changes #39

thejohnfreeman opened this issue Jul 10, 2012 · 0 comments

Comments

@thejohnfreeman
Copy link
Member

  • Rename "lens" to "scratch". Other suggestions include "tunnel", "gate", "prism", "source", etc. but below discussion will use "scratch".

  • No error on target variable. Binders can distinguish variables and scratches. A binder (e.g. the number binder) creates a scratch as convenience only when needed. The programmer can bind to an error only if they explicitly created the scratch for it.

  • No declarative validation, e.g., toModel, toView, validate in a data-bind attribute. The programmer must create a scratch to add custom validation. We will reserve the option to allow, in the future, declarative addition of custom validation.

  • Validating binders prepend their validation when binding to an existing scratch. It is an (undiagnosed) error to duplicate a binder's validation when creating a scratch for the binder. For example,

    <input data-bind="number: y">
    var y = hd.scratch(x).number().min(0); // wrong
    var y = hd.scratch(x).min(0); // right
  • Validator conveniences should be extensible. Programmers should be able to extend new scratch proxies with custom validators.

  • .outgoing should be variadic. When called with multiple validators, they should all be appended.

gfoust pushed a commit to gfoust/hotdrink that referenced this issue Jul 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant