On May 16, 2004, at 11:23 AM, Leszek Dubiel wrote: > I am looking for scripting language to replace Perl, which I am using > now. I don't like Perl, because its awful syntax. I thought about > Python when I've heard of Ruby. I study Ruby now, it seems to be > excellend (everything is object) and I have one question. > > Why do you have two classes of integers? I think there are only two > solutions for numbers in a good language: > > 1. Numbers can be as big as machine word. To use bigger ones module > should be included. > > 2. Nubers can be as big as programmer wants, but DON'T suply two > classes for the same THING. There should be one class to rule them all > -- when number is small it is just one word, when it gets bigger it is > a list. Programmer wants to use numbers and don't want to care about > implementation. If this is so in Ruby, then using two classes is not > good and that classes should be hidden to user (programmer). If Ruby > will have implemented BigNum, Fixnum, then to be complete it sould > implement BigFload (huge precission), Complex, Naturals.... Don't you think that you contradict yourself? You said programmer shouldn't care about the implementation. As long as Fixnum and Bignum both have the same interface (that is the same set of methods with identical signature) you shouldn't care about which class a particular instance has. In Ruby a class of an instance does not define this instance's type. Only methods a particular instance responds to define its type. It's called 'duck typing'. > > I would like to be convinced that Ruby solution is good -- now I don't > see any reason for having two classes and I feel that some time in the > future this would be a problem. Good languages are good at the > beginning, but after few years they are patched, and patched -- they > are getting worse and worse. (For example "use strict" in perl -- it > seems to me as a patch that prevents programmer from doing something > wrong...) > I don't think this is happening with Ruby though. Cheers, Kent.