From: bbense+comp.lang.ruby.Oct.02.02@... Date: 2002-10-03T00:22:59+09:00 Subject: Re: thoughts on typelessness -----BEGIN PGP SIGNED MESSAGE----- In article , William Djaja Tjokroaminata wrote: >Hi Dave, > >I think in my application it is probably enough to check for classes. For >example, my abstract factory pattern function to create a communications >network link is: > >def link (node0, node1, rate = 1e6, delay = 0.0, model = nil, attrs = nil, >type = Link::TYPE_FULL_DUPLEX, label = '', name = '', simStart = false, >simEnd = false, sim = nil) > raise "..." unless rate.kind_of? Float > raise "..." unless delay.kind_of? Float > .... >end > - - Ah ha, at last some code. First of all there is a huge code smell here. You are writing Fortran in Ruby. NO method/function in any language that supports data structures should have more than 3 parameters. ( well maybe 4 in extreme cases.) Certainly, in a Ruby method, more than 3 args is suspcicious. - - Maybe you'd get a lot more out of Ruby if you spent some time refactoring your code. I'd start out by making link an object rather than a method. It's no wonder you want types in Ruby, types would be a great addition to Fortran. - - Booker C. Bense -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBPZsLc2TWTAjn5N/lAQEs0wP/Wv8AO25SOQYT2An9C981k3vAkWCItxTk TWSiFgm5oK85e2M64ihbq5m/tQgeKkfeDdL3xZ1yWueXZsAvaxBgeBkrz6bNS/nx +n1MHCLdjx8/vRpG4axEZEUXj8CQzt0waEPCASRzGdoR4k3BM95enX8MK1v5RBic fnfvlnxKBMQ= =kxGi -----END PGP SIGNATURE-----