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.
toModel
,toView
,validate
in adata-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,
.outgoing
should be variadic. When called with multiple validators, they should all be appended.