Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: integers and sizes

From: sterling::rebol::com at: 18-Apr-2001 16:38

It all looks right. The to- conversions are just that and do not transform a value into another value. They are conversions which means that they return a new value of the new type as long as the original type can be converted into the target type. To work with your examples: a: 2000000001 b: 10000000005 / 5 type? a ;integer! type? b ;decimal! to-integer b ; 2000000001 type? b ;decimal!, wow, that is interesting to-decimal a ;2000000001 but: c: to-integer b ; 2000000001 type? c ; integer! c: to-decimal a ;2000000001 type? c ; decimal! The same thing works with series values that have extra storage associated with them: a: "foo" type? a ; string! b: to-issue a type? a ; string! -- still type? b ; issue! -- converted insert a "bar-" a == "bar-foo" b == #foo when b was converted from the string "foo" to the issue #foo it was copied and therefore is a new value. If the old value is changed, the new value is unaffected. Sterling