withName multiple variable support

I often find myself needing to define multiple name variables before banging out the formula. Currently this means nesting withName(statement1, name1, withName(statement2, name2, ...).

With auto format, this leads to a lot of indentation and encapsulation, which is distracting. It would be great if withName allowed a set to be defined, similar to ModifyRows. I don’t know what syntax would work best with Coda’s formula language, but idea is something like:
withNames(statement1, name1, statement2, name2).Do(...)

3 Likes

If I can add to this, it’d be much neater if it was

WithNames(
  name1, statement1,
  name2, statement2,
  expression)

rather than either:

WithNames(
  statement1, name1,
  statement2, name2,
  expression)

or the current:

WithNames(
  statement1, name1,
WithNames(
  statement2, name2,
  expression))

The first one avoids overuse of parens and the need to balance them. It is also visually cleaner, and works better with the auto-indenter. Lastly, it’s better than the second one because the names are listed first. This is much easier to work with. In pretty much all programming languages you write x = blah blah blah, not blah blah blah → X. The reason for this is that 1) variable names are shorter and easier to alight vertically, and 2) it makes it easier to find what the definition of a variable is. Putting the statement first and then the name second was poor design.