User Tools

Site Tools


at:tutorial:objects

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
at:tutorial:objects [2007/06/27 14:08] jorgeat:tutorial:objects [2007/06/27 14:28] jorge
Line 21: Line 21:
 </code> </code>
  
-As all definitions in AmbientTalk, objects are defined using the **def** keyword. In the example above, the state of the ''Point'' object is composed of ''x'' and ''y'' fields and its behaviour corresponds to the ''init'' and ''sumOfSquares'' methods. +As all definitions in AmbientTalk, objects, fields and methods are defined using the **def** keyword. Fields are defined using a ''def name := value'' syntax while methods are defined using a ''name(parameters) {body}'' syntax. 
-This object can be instantiated to create new points as follows:+ 
 +<note important> 
 +Note that AmbientTalk not only supports traditional canonical syntax (e.g. ''o.m(a,b,c)'') but also keyworded syntax (e.g. ''o.at: key put: value'') for method definitions and message sends, as in SmallTalk. 
 +</note> 
 + 
 +In the example above, the state of the ''Point'' object is composed of ''x'' and ''y'' fields and its behaviour corresponds to the ''init'' and ''sumOfSquares'' methods. This object can be instantiated to create new points as follows:
  
 <code> <code>
Line 32: Line 37:
  
 ===== Sending messages ===== ===== Sending messages =====
-In AmbientTalk, computation is expressed in terms of objects sending messages to one another. +In AmbientTalk, computation is expressed in terms of objects sending messages to one another. Messages are used to invoke  
 + 
 +access to  
 + 
 +access to the fields and methods of the objects
  
 Object's fields and methods are accessed as follows: Object's fields and methods are accessed as follows:
Line 43: Line 52:
 </code> </code>
  
-<note important> +
-Note that AmbientTalk supports both traditional canonical syntax (e.g. o.m(a,b,c)) as well as keyworded syntax (e.g. o.at: key put: value) for method definitions and message sends. +
-</note>+
  
 ===== Cloning and instantiation ===== ===== Cloning and instantiation =====
at/tutorial/objects.txt · Last modified: 2013/05/17 20:23 by tvcutsem