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

MathGroup Archive 2013

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

Search the Archive

Dynamic scoping

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129642] Dynamic scoping
  • From: Daniel Huber <danielphuber at gmail.com>
  • Date: Sat, 2 Feb 2013 01:15:47 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Block is supposed to be a dynamic scoping construct. Therefore, in the following, "Print" should be an undefined function. But consider:

Block[{Plus},
 t = ToString[Plus[1, 2]];
 Print[t];
 ]

The output of this is: "3" and not "Plus[1,2]" as it would be if "Print" has no defined meaning.
cheers, Daniel



  • Prev by Date: Re: strange behaviour of ListPlot with PlotStyle options in
  • Next by Date: Re: Apollonius' circle tactation
  • Previous by thread: Re: strange behaviour of ListPlot with PlotStyle options in
  • Next by thread: Re: Dynamic scoping