I guess a better way to phrase my argument is:

What situation are you in where you don't know the current state?

That is, consider the following:


```
if (enabled) {
  set render state to "enabled", set action to "delete"
} else {
  set render state to "disabled", set action to "add"
}
```

versus:

```
set action to "toggle"
if (enabled) {
  set render state to "enabled"
} else {
  set render state to "disabled"
}
```

What I'm trying to say is that "toggle" is ambiguous without checking the
current state. Adding a set toggle method only serves to allow "drift" --
where you have a state assumption of "enabled" but the set is actually
disabled, or vice versa. Set should be explicit -- this doesn't mean you
need to litter your code with guards, but instead the state of an
application using a set should know if it needs to remove or add, and the
use of a "toggle" implies the state of the set is ambiguous. Either way. I
don't think the UI checkbox use case is compelling enough to add to the
prototype for Set.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to