From: Gavin Sinclair Date: 2004-01-13T19:09:08+09:00 Subject: Re: faster integer arithmetics & arbitrary precision floating number On Tuesday, January 13, 2004, 2:21:37 PM, GGarramuno wrote: > gabriele renzi wrote in message > news:... >> il 12 Jan 2004 22:27:13 GMT, ggarramuno@aol.com (GGarramuno) ha >> scritto:: >> >> >> >> >Python2.2's numbers are now also objects and thus it also has to check if it >> >has to do the same type of dispatching that Ruby does, yet its speed is much, >> >much closer to Perl's. >> >> still, you can't reopen base classes in python, IIRC.. > No, you can't, but you can now inherit from them and create your own > subclass and any function that uses the base class (say ints) can take > your new class type, too. > To be honest, I see this as a better approach. You get the speed > benefit and safety, too. > I am still not 100% convinced that Ruby's feature of reopening base > classes is truly a benefit. I see it as a long string of rope for > hanging yourself in the long run, perhaps. A common worry for people new to the language. > I mean, for my own personal code, I see the ability to extend base > classes as a great benefit. I know in a year or so I would easily > have a String, Fixnum, etc. classes with tons of new things in them. There you go: "a great benefit". > But so would most ruby users, I assume. I fret at the prospect of one > day trying to integrate two libraries or two pieces of code that have > an extended base class with similar named functions that do completely > different things. Like many things about Ruby: a problem in theory (or can be construed as such), but not in practice. Remember that Ruby's niche is (IMO) in creating really really useful apps with a small LOC count. That means you can achieve more functionality with a single person, who can assume greater control of their environment. Naturally, Ruby projects that break out into group efforts are likely to place restrictions on what "tricky" things are used. It's called coding standards, and all group projects need (or benefit from) them no matter what language is used. At the end of the day, 99% of Ruby programs are created for the specific needs of their author alone. More power to them. > But then again, I am quite new to Ruby. I am sure this issue might > have already arised, and there may be a workaround for it? > Can extensions to base classes be kept within a specific namespace > only? Such namespaces will possibly/probably bew a core language feature in the near future. See Matz's slides on the future of Ruby from the last conference. Cheers, Gavin