From: David Vallner Date: 2006-11-06T09:00:16+09:00 Subject: Re: Ruby.extend Javascript --------------enig1FEAE35E68CA58FECA1E2F42 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Trans wrote: > So would Ruby benefit from being able to do this inherently? Or are > there reasons against it and it is actaully Javascript that's suffering= > for it? Or is there some difference between Ruby and Javascript that > makes it good for one, but not the other? >=20 It's the expected way of doing things in prototype-based OO - a class definition is sum of method additions to its parent prototype. Ruby is mainly a class-based OO language, which means readers of the code expect to see class definitions, not prototype manipulations. It is generally possible to implement a class-based object system in a prototype-based language and the other way around, but generally other users of a language will easier understand code written in a language's primary flavour. Also, that flavour will probably be more efficient because it gets first-class support (and is usually the flavour implemented in C these days.) There's nothing inherently "wrong" about using prototype-style OO in Ruby while heavily abusing singleton methods or automagical delegates, but it will confuse people reading that code. There's also no RDoc support for sniffing that code structure, and various other quirks. But it's a valid approach in my book. David Vallner --------------enig1FEAE35E68CA58FECA1E2F42 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFTnsHy6MhrS8astoRAtiTAJ4h3d5cFtFyDNoCnGMmky8NdKHAdACdHhms vZjeNXmjX2rJ79F2GPURijM= =FuAu -----END PGP SIGNATURE----- --------------enig1FEAE35E68CA58FECA1E2F42--