Made some changes to Dequoter to support analysis plugins. These are plugins which will produce a result that appears in the status bar, as oppose to transform the selected text. Used it to remake my sum plugin:

d:analyze "Lines: Sum" { |in|
  count = 0
  d:map-lines $in (proc { |l|
    if (int? $l) {
      count = add $count $l
    }
  })
  "Sum: ${count}"
}

This relies on a new UCL builtin called int?, which will return true if the given argument can be coerced to an integer. For now, this is only strings or ints: other types, such as nil, can be converted but would produce an error when used with the add builtin. I’m not sure whether this is right, or whether it’d would be better to add nil support to add. My general direction is towards stricter typing semantics, similar to Python but maybe not as strict, maybe as strict as Lua. And this would leave int? being slightly more strict than what is possible in the evaluator. Probably not “correct” in a pure sense, but at least it makes it useful.

In either case, it does the job:

A text editor window named Dequoter displays multiple lines of lorem ipsum placeholder text followed by several test lines and a highlighted section containing numbers and letters.

Follow up

I’ve since been aware of the Lua function math.type:

Returns “integer” if x is an integer, “float” if it is a float, or fail if x is not a number.

This is very close to what I’m envisioning for int?: a guide that something can be used with arithmetic operations. Maybe that’s how this builtin should be used.