On Apr 21, 2010, at 7:11 PM, Lukas Renggli wrote: >> thisContext is a special object for representing an activation in a >> stack frame in a stack-based VM. > > Actually "thisContext" represents *the current* activation/stack-frame. > > foo: anObject > ^ thisContext at: 1 > > is the same as > > foo: anObject > ^ anObject > >> There are two kinds of contexts: >> Method Contexts and Block Contexts. > > Actually in Pharo images there are only instances of MethodContext. > Though you can ask the context if it comes from a block by sending the > message #isExecutingBlock. > >> Context creation is optimized in the VM in most Smalltalks, so it's >> only really created as an object in the environment (reified) when >> it's specifically needed through "thisContext". > > In Pharo contexts are not reified like that. Stack-frames are actual > objects at all times. However, for speed reasons, their creation and > garbage-collection is optimized by the VM. Stack frames get > automatically recycled if nobody refers to them.
Hernan you used VW I see :) In Pharo this is like lukas said, we got this discussion with him for some seaside papers :) > >> There are several applications related with computational reflection >> (Reflective Programming, Meta-Programming, MOP, etc) which makes use >> of the current context. > > Also: exception handling, generators, continuations, co-routines, ... > > For another fun use of "thisContext" check this Stack-Overflow question: > > http://stackoverflow.com/questions/2500483/is-there-a-way-in-a-message-only-language-to-define-a-whiletrue-message-without-r > > Lukas > > -- > Lukas Renggli > www.lukas-renggli.ch > > _______________________________________________ > Pharo-project mailing list > Pharo-project@lists.gforge.inria.fr > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project