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 revisionBoth sides next revision
at:tutorial:objects [2007/06/27 14:09] jorgeat:tutorial:objects [2007/06/27 14:23] 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. 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: This object can be instantiated to create new points as follows:
  
Line 32: Line 32:
  
 ===== 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:
at/tutorial/objects.txt · Last modified: 2013/05/17 20:23 by tvcutsem