From: Florian Gilcher Date: 2008-05-17T09:24:39+09:00 Subject: Re: Not quite getting it. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On May 17, 2008, at 1:02 AM, ara.t.howard wrote: > On May 16, 2008, at 12:45 PM, Roger Alsing wrote: > >> Ok ok, as I said, I get type promotion. >> But what if you assign a "Giraffe" to a property called "Orders" , >> isnt >> that just as bad or even worse than overflowing a number? > > > > then you will need a tall box. Pragmatic Programming ;). Roger, just because variables are not typed doesn't mean that you can't check for Types. Actually, Rubys type-system is quite strong, it doesn't allow casts. You can very easily build objekt properties that check for type or a certain set of methods. Something like: class Test attr_accessor :order def order=(order) if order.kind_of?(Giraffe) raise Exception.new("We package nearly everything, but Giraffes????") end end end So Ruby does typing, but on a different level. It assumes that all objects are sane and then gives you the possiblity to check all the information that the object propagates and use that for reasoning. See it as a service-based approach. Wouldn't be the first time a service does not do what the name implies ;). The numbers problem: Conceptually, there is also no such thing as an "overflowing number", in Ruby because Ruby abstracts high enough that you as a Programmer do not have to to care about those technical implications. This is a completely different ballpark ;). Regards, Florian Gilcher -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkguJcMACgkQJA/zY0IIRZbWPQCfWGQIQGaBh1LkaHHqcUCtUbpZ GiwAn3pWUIjEvwTubAwgodxuyK1oRLZX =95BN -----END PGP SIGNATURE-----