#IdentityIncludes: for FloatArray

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

#IdentityIncludes: for FloatArray

Cyrille Delaunay-3


try to inspect:
(FloatArray new:1)at: 1 put: 2.5 ; yourself
and print:
self identityIncludes: self anyOne

It returns false.
Is it a 'normal' comportment ?


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: #IdentityIncludes: for FloatArray

Nicolas Cellier
FloatArray is a raw array of bits interpreted as single precision (32
bits) floats. It does not contain any object pointer, only the content
(value).
At each access #at: will create a new Float (64 bits).
So you have (self at: 1) ~~ (self at: 1).

Does that explain?

Nicolas

2009/6/11 Cyrille Delaunay <[hidden email]>:

>
>
> try to inspect:
> (FloatArray new:1)at: 1 put: 2.5 ; yourself
> and print:
> self identityIncludes: self anyOne
>
> It returns false.
> Is it a 'normal' comportment ?
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

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