|
|
|
|
|
by patrec
3490 days ago
|
|
Let's take your static printf as a concrete example. Here's what a not so great error message looks like (ocaml's built in Printf): utop # Printf.sprintf "Some int: %d another int: %d" 1 "2";;
Error: This expression has type string but an expression was expected of type int
Here's what a good error message looks like: clang -Wall printf.c
printf.c:6:52: warning: format specifies type 'int' but the argument has type 'char *' [-Wformat]
printf ("Some int: %d some other int: %d\n", 1, "2");
~~ ^~~
%s
Notice how it also highlights the mismatched part in the string-based DSL. |
|
But maybe this is detrimental to clarity of errors in some cases. I'd be interested to see how Racket handles errors.