For fun, I like to use Trace with option TraceInternal->True to see if I figure how some of the commands work internally.

I just noticed something strange. In Version 9, I got lots of what seem like error messages that I do not get in Version 8. This example below is using Plot (I have not tried many other commands, will do that later).

Consider the most basic plot. See the difference in Trace between V8 and V9:

   Trace[Print@Plot[Sin[x], {x, -Pi, Pi}], TraceInternal -> True]

enter image description here

ofcourse, the command works just fine at the end in V9, and one gets the plot.

So these messages do not affect the final result, and hence, from a user point of view, one can argue that they should not matter as long as the final result is the same. They could be some internal trace messages that are left there in final build or such?

I am just curious, that is all, if someone might know what they could mean, since they do indicate some sort of an error condition, yet final plot is just fine.

  • 13
    $\begingroup$ The QuantityForm seems to suggest that the errors result from some pre- or postprocessing for the new Quantity and unit support. That more and more seems like a woefully unfinished product. $\endgroup$
    – Jens
    Dec 17, 2012 at 20:00
  • $\begingroup$ No need to use TraceInternal $\endgroup$
    – Rojo
    Dec 17, 2012 at 20:13

1 Answer 1


QuantityForm (and some other formatting functions) issues messages at typesetting instead of evaluation, and Trace is generating output that is in an unevaluated state, which QuantityForm isn't expecting.

Here's a couple of similar examples:

Trace[Block[{form = "LongForm"}, QuantityForm[Quantity[1, "Meters"], form]]]
Trace[Block[{digits = 3}, NumberForm[N[Pi], digits]]]

To be clear, these messages are still coming from the kernel, but during the construction of boxes for the frontend.

In[]:= ToBoxes[NumberForm[N[Pi], digits]];5

NumberForm::iprf: Formatting specification digits should be a positive   
    integer or a pair of positive integers.

Out[]= 5

and that the messages generally won't appear if the output is suppressed:

In[]:= NumberForm[N[Pi], digits];5

Out[]= 5

It also means that the messages can be hard to suppress

In[]:= Quiet[NumberForm[N[Pi], digits]]

NumberForm::iprf: Formatting specification digits should be a positive 
    integer or a pair of positive integers.

Out[]//NumberForm= 3.14159

since Quiet goes away once its arguments have finished evaluating, but the problematic form is still present and will still issue messages when formatted.

  • $\begingroup$ The messages generated by these functions go through the kernel or are generated entirely by the FrontEnd and the kernel is not aware about them? $\endgroup$ Jan 9, 2013 at 9:54
  • 1
    $\begingroup$ @AlexeyPopkov They're from the kernel. I updated my answer to explain it a bit better, I hope. $\endgroup$ Jan 9, 2013 at 15:03
  • $\begingroup$ Thank you. It was not clear for me that the term "at typesetting" should be read as "in the kernel during the construction of boxes for the frontend". Does typesetting also always means literal calling ToBoxes? $\endgroup$ Jan 9, 2013 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.