From: Paul Brannan Date: 2007-12-29T03:28:14+09:00 Subject: Re: Matz says namespaces are too hard to implement - why? On Sat, Dec 29, 2007 at 12:54:28AM +0900, Rick DeNatale wrote: > > > def divide(a, b) > > > use namespace Mathn > > > a / b > > > end > > > > > > Now, I'd think you would want: > > > > > > 1 / 2 #=> 1 > > > > > > divide(1,2) #=> 1 / 2 ... > What causes the integer 1 to use the '/' method monkeypatched in Mathn > in one case and not the other? In the first case (1 / 2), the Mathn namespace is not active, so the usual integer division method applies. In the second case (divide), the Mathn namespace is active, so Integer#/ defined in the Mathn namespace applies. Paul