From: Wesley J Landaker Date: 2003-11-20T14:05:37+09:00 Subject: "stereotyping" thread --Boundary-02=_YuEv/Tkrv4W8PF+ Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Description: signed data Content-Disposition: inline Why not just use empty modules for all this type-checking? This isn't=20 very useful to me personally, but it seems to do everything that has=20 been mentioned in this whole "stereotyping" thread (i.e. emits warnings=20 if the passed in types haven't been manually tagged by a programmer as=20 implementing a particular interface): class Object def typecheck(type) unless self.kind_of?(type) $stderr.puts "WARNING: expected #{type}, got #{self.class}" end end end module SomeInterface end def function_expecting_SomeInterface(var) var.typecheck(SomeInterface) end def function_expecting_Numeric(var) var.typecheck(Numeric) end class SomeClassThatClaimsToSupportSomeInterface include SomeInterface end class String #mark Strings as implementing some interface include SomeInterface end I'm not sure how special language syntax would help anything in this=20 regard... =2D-=20 Wesley J. Landaker - wjl@icecavern.net OpenPGP FP: 4135 2A3B 4726 ACC5 9094 0097 F0A9 8A4C 4CD6 E3D2 --Boundary-02=_YuEv/Tkrv4W8PF+ Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQA/vEuY8KmKTEzW49IRAnI3AJ99p2UpKRTtNBS5FajnFNEAdh0grgCggM9X HI/NEnImU3n3Go9WnmSMsqs= =Kd/0 -----END PGP SIGNATURE----- --Boundary-02=_YuEv/Tkrv4W8PF+--