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: