User Tools

Site Tools


Sidebar

Jump to
AmbientTalk
CRIME
iScheme

at:tutorial:multiparadigm

This is an old revision of the document!


On Scoping, Closures, Methods and Messages

This tutorial chapter is still under construction

This tutorial chapter goes into a bit more detail on the subtle interplay between AmbientTalk's functional aspects (e.g. block closures, higher-order functions and lexical scoping) and its object-oriented aspects (e.g. objects and delegation). It is also described how methods and messages can be manipulated as first-class objects in their own right.

Scoping

AmbientTalk distinguishes between two kinds of scoping rules:

  1. the lexical scope, which is the traditional scope one assumes when nesting language elements: variables which are lexically visible within an enclosing scope should be accessible within the enclosed scope.
  2. the object scope, which is delimited by a chain of delegating objects. When sending a message to an object, the object and its parent objects delimit the scope in which the message is looked up.

Nesting Objects

Lexical vs Object Scope

Methods vs Closures

External Methods

First-class Methods

First-class Messages

at/tutorial/multiparadigm.1182243817.txt.gz · Last modified: 2007/06/19 11:21 (external edit)