In fact I let it because I did not write it but I will remove this section and add a section including your text more at the end of the chapter Stef Le 15/2/16 00:34, Eliot Miranda a écrit :
Hi Stef,
"Implementation note. Deep in the implementation of Pharo, there are three different kinds of objects: 1. ordinary objects with instance variables that are passed by references 2. small integers that are passed by value 3. indexable objects like arrays that hold a contiguous portion of memory The beauty of Pharo is that you normally donât need to care about the differences between these three kinds of object."
The distinction between 1. and 3. is erroneous. Both Arrays and normal objects are passed by reference. And with Pharo 5 there are more kinds of immediate objects than SmallInteger.
This should read something like the following. And I would put it much later in the chapter.
"Implementation note. Deep in the implementation of Pharo, there are two different kinds of objects: 1. objects with zero or more fields that are passed by reference and exist on the Pharo heap 2. immediate objects that are passed by value. Depending on version these are a range of the integers called SmallInteger, all Character objects and possibly a sub-range of 64-bit floating-point numbers called SmallFloat64. In the implementation immediate objects occupy an /object pointer/, most of whose bits encode the immediate's value and some of the bits encode the object's class.
The first kind of object, an ordinary object, comes in a number of varieties 1. normal objects that have zero or more named instance variables, such as Point which has an x and a y instance variable. Each instance variable holds an object pointer, which can be a reference to another ordinary object or an immediate. 2. indexable objects like arrays that have zero or more indexed instance variables numbered from 1 to N. Each indexed instance variable holds an object pointer, which can be a reference to another ordinary object or an immediate. Indexable objects are accessed using the messages at: and at:put:. For example ((Array new: 1) at: 1 put: 2; at: 1) answers 2. 3. objects like Closure or Context that have both named instance variables and indexed instance variables. In the object, the indexed instance variables follow the named instance variables. 4. objects like ByteString or Bitmap that have indexed instance variables numbered from 1 to N that contain raw data. Each datum may occupy 8, 16 or 32-bits, depending on its class definition. The data can be accessed as either integers, characters or floating-point numbers, depending on how at: and at:put: are implemented. The at: and at:put: methods convert between Pharo objects and raw data, hiding the internal representation, but allowing the system to represent efficiently data such as strings, and bitmaps.
A beauty of Pharo is that you normally donât need to care about the differences between these three kinds of object."
Note that I replaced "The beauty" with "A beauty".
Personally I would introduce the idea of classes after giving examples of the different kinds of objects, and introducing polymorphism and message syntax. You might mention that all objects are instances of a class and the class defines the layout and behaviour of the object, but say no more until you've presented objects and messaging. = and > are good messages to demonstrate polymorphism with; you can use them with integers, floats characters, strings and points.
On Sun, Feb 14, 2016 at 5:45 AM, stepharo <stepharo@free.fr <mailto:stepharo@free.fr>> wrote:
Hi guys
I finished to revisit the chapter Pharo object model for updated pharo by example
Here it is: https://ci.inria.fr/pharo-contribution/view/Books/job/UpdatedPharoByExample/...
Stef
-- _,,,^..^,,,_ best, Eliot