Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Format and MakeBoxes in depth - Part 1

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122691] Format and MakeBoxes in depth - Part 1
  • From: Rui <rui.rojo at gmail.com>
  • Date: Sun, 6 Nov 2011 05:55:45 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Reply-to: comp.soft-sys.math.mathematica at googlegroups.com

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