[Glass] 0.01 copy == 0.01

James Foster james.foster at gemtalksystems.com
Thu Feb 27 06:56:23 PST 2014


On Feb 27, 2014, at 4:58 AM, Mariano Martinez Peck <marianopeck at gmail.com> wrote:

> 0.01 copy == 0.01    
> -> true
> 
> So...is this a compiler optimization? Is it something related to the fact that SmallDouble are immediate objects? 

It is not a compiler optimization but a side-effect of the fact that (as you note) SmallDouble are immediate objects so there are never any distinct copies. The behavior is similar to the following:

42 copy == 42. “true”
$a copy == $a. “true”
nil copy == nil. “true"
true copy == true. “true”


James


More information about the Glass mailing list