Dear List,

Here are the notes I took on AmbientTalk.

In Ambientalk:

Table:
>def table[5] { z := z + 1 }
>>[1, 2, 3, 4, 5]


Table splicing:
>[1,@[2,3],4]
>>[1, 2, 3, 4]
>def [first, @rest] := [1,2,3,4]
>>[1, 2, 3, 4]
>rest
>>[2, 3, 4]


Function
>def square (x) { x*x }
>>nil
>square(5)
>>25

There is no check about fulfilling required methods. There is a way to declare a method as required. Required method are part of a structural type. Reflection is then used to ensure that a composition makes sense at composition time. Aliasing changes the name on the surface (it is not a rename), and does not create a new entry. The import clause (which is used to use a trait), may accept any expression, and not only a trait name.
There is no precedence of the locally defined methods.

Note that traits are composed when object composer are instantiated.

Ambientalk may use the same trick than in Smalltalk to declare a method as required (self requiredMethod), but the lack of precedency is problematic. The fact that you do not have precedency, implies that a method used in a trait needs to be specify as required (using the reflective trick mentioned above) in case of the composer is likely to not provide an implementation for this method. Else, better is not mark the used method as required since the composer will have to exclude it when using the trait.

Two methods that are acquired using different import path are not conflicting since they are the same compiled method. In Ambientalk, this will always cause a conflict since methods are “duplicated” between composers. In Ambientalk, deep equality (i.e., comparing bytecode instructions) may not lead to what we want since methods can be nested.

The Morphic framework.
Inspired from the Self version and has been influenced by John Maloney’s work. Requirement between traits is specified with for exemple require: [Trait1, Trait2], in that case, all public methods defined in Trait1 and Trait2 will be set as required method for the trait that made the require.
This framework is composed of 18 traits

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to