MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Format and MakeBoxes in depth - Part 1


I have actually deep doubts about these functions, but I'll try to start with a small concrete one that bugs me...

I define a format for the symbol "lo"
Format[lo, StandardForm]:=(Print[""];la[]);
Now, if I call MakeBoxes on it, result is what I expected
In:
MakeBoxes[lo, StandardForm]
Out:
[Empty line... Print[""]'s fault]
RowBox[{"la", "[", "]"}]

However, if I look into the definitions
In:??lo
Out:
la[]/:MakeBoxes[la[],StandardForm]:=Format[Print[];la[],StandardForm]

Those first 2 la[] I'm pretty sure are actually lo's printed out as la[].
The last one after Print[] should be actually la[]. So it actually means
lo/:MakeBoxes[lo,StandardForm]:=Format[Print[];la[],StandardForm]

So, if MakeBoxes[lo, StandardForm]:=Format[Print[];la[], StandardForm], how come it returns a box structure when Format[Print[];la[], StandardForm] by itself returns unevaluated?




  • Prev by Date: What gets put in ~/.Mathematica and why?
  • Next by Date: Re: How to evaluate parts of an expression, but not other parts?
  • Previous by thread: Re: What gets put in ~/.Mathematica and why?
  • Next by thread: Delayed symbol resolution