Skip to main content
deleted 552 characters in body
Source Link
Jacob Akkerboom
  • 12.2k
  • 46
  • 82

This discussion is completely in the context of DynamicModule, which appears to be irrelevant when we consider the following examples.

x := Print["hello"];
ToString @@ Unevaluated /@ Dynamic[x]

and

y[] := Print["hello"]; 
ToBoxes[ToString @@ Unevaluated /@ Dynamic[y[]]]

Where in the first example x is evaluated, but in the second example y[] is not. So while Michael is probably right that the behavior occurs because we want more speedy evaluation, it does not have to do with DynamicModule.


I don't know if I like my interpretation of the examples below anymore. I will just leave them here though

This discussion is completely in the context of DynamicModule, which appears to be irrelevant when we consider the following examples.

x := Print["hello"];
ToString @@ Unevaluated /@ Dynamic[x]

and

y[] := Print["hello"]; 
ToBoxes[ToString @@ Unevaluated /@ Dynamic[y[]]]

Where in the first example x is evaluated, but in the second example y[] is not. So while Michael is probably right that the behavior occurs because we want more speedy evaluation, it does not have to do with DynamicModule.


I don't know if I like my interpretation of the examples below anymore. I will just leave them here though

I don't know if I like my interpretation of the examples below anymore. I will just leave them here though

Without DynamicModule
Source Link
Jacob Akkerboom
  • 12.2k
  • 46
  • 82

This discussion is completely in the context of DynamicModule, which appears to be irrelevant when we consider the following examples.

x := Print["hello"];
ToString @@ Unevaluated /@ Dynamic[x]

and

y[] := Print["hello"]; 
ToBoxes[ToString @@ Unevaluated /@ Dynamic[y[]]]

Where in the first example x is evaluated, but in the second example y[] is not. So while Michael is probably right that the behavior occurs because we want more speedy evaluation, it does not have to do with DynamicModule.


I don't know if I like my interpretation of the examples below anymore. I will just leave them here though

Here is more crazyness. I think Michael explains quite well what happens. The only thing new this first section shows is that new symbols get created sometimes, which makes it seem functions point to the wrong thing, but that actually does not matter.

Here is more crazyness. I think Michael explains quite well what happens. The only thing new this first section shows is that new symbols get created sometimes, which makes it seem functions point to the wrong thing, but that actually does not matter.

This discussion is completely in the context of DynamicModule, which appears to be irrelevant when we consider the following examples.

x := Print["hello"];
ToString @@ Unevaluated /@ Dynamic[x]

and

y[] := Print["hello"]; 
ToBoxes[ToString @@ Unevaluated /@ Dynamic[y[]]]

Where in the first example x is evaluated, but in the second example y[] is not. So while Michael is probably right that the behavior occurs because we want more speedy evaluation, it does not have to do with DynamicModule.


I don't know if I like my interpretation of the examples below anymore. I will just leave them here though

Here is more crazyness. I think Michael explains quite well what happens. The only thing new this first section shows is that new symbols get created sometimes, which makes it seem functions point to the wrong thing, but that actually does not matter.

improved formatting
Source Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751

-> Hold[FE`x$$213]

Hold[FE`x$$213]

-> Hold[FE`x$$213]

Hold[FE`x$$213]

-> Hold[x$314]

Hold[x$314]

-> {HoldPattern[FE`ff$$213] :> 1}

{HoldPattern[FE`ff$$213] :> 1}

-> FE`z$$225

FE`z$$225

-> z$1236

z$1236

-> {{HoldPattern[FEgg$$270]:>FE'x$$270},Hold[FEx$$270]}

 {{HoldPattern[FE`gg$$270]:>FE'x$$270},Hold[FE`x$$270]}

-> {{HoldPattern[FEgg$$271]:>0},Hold[FEx$$271]}

 {{HoldPattern[FE`gg$$271]:>0},Hold[FE`x$$271]}

-> {{HoldPattern[FEgg$$312]:>0},Hold[FEx$$312]}

{{HoldPattern[FE`gg$$312]:>0},Hold[FE`x$$312]}

-prints-> gg

gg (*print*)

-prints-> x

x (*print*)

-prints-> ggDone

ggDone (*print*)

-prints-> x

x (*print*)

-> Null

Null

-prints-> x

x (*print*)

-prints-> gg

gg (*print*)

-prints-> x

x (*print*)

-prints-> ggDone

ggDone (*print*)

-> Null

Null (*print*)

-> Hold[FE`x$$213]

-> Hold[FE`x$$213]

-> Hold[x$314]

-> {HoldPattern[FE`ff$$213] :> 1}

-> FE`z$$225

-> z$1236

-> {{HoldPattern[FEgg$$270]:>FE'x$$270},Hold[FEx$$270]}

-> {{HoldPattern[FEgg$$271]:>0},Hold[FEx$$271]}

-> {{HoldPattern[FEgg$$312]:>0},Hold[FEx$$312]}

-prints-> gg

-prints-> x

-prints-> ggDone

-prints-> x

-> Null

-prints-> x

-prints-> gg

-prints-> x

-prints-> ggDone

-> Null

Hold[FE`x$$213]
Hold[FE`x$$213]
Hold[x$314]
{HoldPattern[FE`ff$$213] :> 1}
FE`z$$225
z$1236
 {{HoldPattern[FE`gg$$270]:>FE'x$$270},Hold[FE`x$$270]}
 {{HoldPattern[FE`gg$$271]:>0},Hold[FE`x$$271]}
{{HoldPattern[FE`gg$$312]:>0},Hold[FE`x$$312]}
gg (*print*)
x (*print*)
ggDone (*print*)
x (*print*)
Null
x (*print*)
gg (*print*)
x (*print*)
ggDone (*print*)
Null (*print*)
Sections, reference to Michaels good answer
Source Link
Jacob Akkerboom
  • 12.2k
  • 46
  • 82
Loading
Sections, reference to Michaels good answer
Source Link
Jacob Akkerboom
  • 12.2k
  • 46
  • 82
Loading
Added an examples with print and HoldComplete
Source Link
Jacob Akkerboom
  • 12.2k
  • 46
  • 82
Loading
Source Link
Jacob Akkerboom
  • 12.2k
  • 46
  • 82
Loading