The change makes a difference because Typed Racket's type inference
for `cons` is producing a less-accurate answer than it could. When it
sees arguments of type `String` and `(Listof Any)`, it decides that
the result is a `(Listof Any)` instead of a `(Pairof String (Listof
Any))`.
If you add (excessive) annotation like this:
(apply fprintf (ann (cons (current-output-port) (ann (cons
message messageargs) (Pairof String (Listof Any))))
(Pairof Output-Port (Pairof String (Listof Any)))))
then the expression typechecks as written.
However, I think the use of `apply` without the extra `cons` calls is
clearer anyway, in addition to being easier for the type checker.
Sam
> To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/CAEEP09AhmxLHeRdOpzpuG7qC9jOuPTrpog92G_3b6nJWwZDzbw%40mail.gmail.com.