From: Chad Perrin Date: 2010-11-15T13:51:07+09:00 Subject: Re: Ruby vs PHP for the web --AqsLC8rIMeq19msA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 13, 2010 at 01:35:41AM +0900, Mike Stephens wrote: > Robert Klemme wrote in post #960960: > > > > > > There seems to be some disagreement what exactly "strongly" and > > "weakly" means here. >=20 > To me it's pretty straightforward. An object of Class A cannot be > treated as an object of Class B - the language system detects and > prevents this. Ruby does not follow this approach. It uses duck typing > which is the opposite. Not quite. The type of an object of class A is never changed. Rather, a method of class A is executed to produce a return value of class B. The class of the object of class A never changes. :~> irb irb(main):001:0> a =3D 3 =3D> 3 irb(main):002:0> a.class =3D> Fixnum irb(main):003:0> b =3D "foo" =3D> "foo" irb(main):004:0> c =3D "#{b} #{a}" =3D> "foo 3" irb(main):005:0> a.class =3D> Fixnum Would you prefer that a programming language have no way to do anything with an integer in conjunction with a string if it's called "strong typing"? --=20 Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] --AqsLC8rIMeq19msA Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkzguqsACgkQ9mn/Pj01uKXZlgCg0KbdVJotXZvJ4f48wfKbyBqY MPkAoIUdC0OVxbCNJMUUndonldZSYD6x =VEDs -----END PGP SIGNATURE----- --AqsLC8rIMeq19msA--