Expanding my comment from the chaining comparitor proposal...
Currently we write:
if (longVariableName == 'p' || longVariableName == 'div') {...}
if (effectiveMousePos.x <= right && effectiveMousePos.x >= left) {...}
and it's annoyingly verbose. Instead, I'd like to write:
if (longVariableName in {{p, div}}) {...}
if (effectiveMousePos.x in [<left, right>]) {...}
Sets are kind of like maps, so you can write (I have written)
if (longVariableName in {p:1, div:1}) {...}
but the irrelevant values are distracting, so it's awkward. Doubly so if there's a formatter or style rule that insists on thinking of the set as a map.
Literals and in
tests are the case I most care about, but as long as we're doing this...
set[key] = True/False
adds or removes a key from a set- sets take
*
,+
, and-
operators for intersection, union, and set-difference, with obvious*=
,+=
, and-=
. for (i in set)
does this obvious- ranges have members
start
,end
,min
, andmax
. The first two are ordered based on definition, the latter based on comparison. for (i of range)
starts atmin
, then adds 1 untili
exceedsmax
for (i of range.by(step))
does the same except that it addsstep
each time. Ifstep
is negative, it starts frommax
.