From: Florian Gilcher Date: 2008-08-01T02:14:31+09:00 Subject: Re: How to do methodsoverloading in -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Jul 31, 2008, at 1:08 PM, David A. Black wrote: > Hi -- > > >> But the brevity sort of goes out the window if every method has to >> paranoidly check the class of every parameter passed to it. It's a >> bit >> of a pain. But so is the alternative. >> >> I gather from what David says that there's no magic bullet...? > > There are two reasons not to check the class of every parameter: > > 1. It doesn't work, because objects aren't limited to the behavior > defined in their classes. > 2. It stops you from thinking more flexibly about how to leverage > the power of Ruby objects, rather than smothering it. I really liked you talk at EuRuKo about that topic which illustrated quite well why "type" is a convention that should not be overused in a dynamic language. For this interested, it should be available here: http://www.avc-cvut.cz/avc.php?id=6882 (offline at the moment, i contacted the EuRuKo-guys) But I do think that splitting methods into clauses depending on argument patterns is a thing thats really missing in ruby (or most OO- languages), because it solves the problem of not being able to change behaviour of proxy methods without reimplementing the whole method. Be aware that I am talking about arbitrary patterns here, not type patterns. [1] Regards, Florian Gilcher [1] For those of you that where at the EuRuKo 2008 and heard my talk: my library accomplishing this task is not ready at the moment because i have absolutely no time. If someone is interested in code that is in alpha state, drop me a line. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkiR8yIACgkQJA/zY0IIRZa+2gCfdLRWDoU5ilJw4YsjVAz2Xhba dX8AoKeB5KniAvpv8dM6KzPE27/6Auhk =iRYG -----END PGP SIGNATURE-----