what is the nicest way you know to make this work:
import strutils
echo "$foo, $baa" % {"foo": "foofoo", "baa": "baabaa"}
# foofoo, baabaa
also, should this maybe be possible in standard Nim? This would be so convenient!
I'm sure this is not the most efficient or most all-encompassing way to do it but it's one of the simplest:
import sequtils, strutils, tables
proc `%` (s: string, subs: openArray[(string, string)]): string =
var newSubs = newSeqOfCap[string](subs.len * 2)
for sub in subs:
newSubs.add(sub[0])
newSubs.add(sub[1])
result = format(s, newSubs)
echo "$foo, $baa" % {"foo": "foofoo", "baa": "baabaa"}
You can also do "$foo $bar" % ["foo", "foofoo", "bar", "barbar"] today. Handling the table syntax would be neat though, even if we have strformat, since that's compile time only.