Closed jrenner closed 6 years ago
That search query doesn't seem to have any results for me.
I did however find this:
It looks this is an area that could use some work.
@jrenner So how did you get around that limitation.. I have really long message formatting, and instead of copy/pasting the message, I wished I could store the string representing that format to a var and do fmt(VAR)
.
Here's a simple case:
import strformat
let
a = 100
msg = "a = {a}"
echo fmt(msg)
But here's that actual msg
: "The '{argval}' value for ':{arg}' is invalid. The only valid values are 'yes' and 'no'."
.
Not to be cliche by comparing to Rust, but in learning some Rust recently I was blown away by how helpful the compiler error messages were. I think Nim could improve a lot in this area, and I might be interested in helping out if the maintainers think it would be a good idea.
Here is one example I ran across recently:
compiler message:
Error: & only works with string literals
improvement: might also mention something about "fmt", & made me think of string concat at first suggested new message:
Error: strformat module string formatting (fmt(), &) only works with string literals
I'm curious what others think.