From: gabriele renzi Date: 2004-12-01T17:57:45+09:00 Subject: Re: Optional static typing (or, What can Ruby 2.0 borrow from Boo?) Lothar Scholz ha scritto: > > gr> I guess the type theorist out there would not agree (i.e. I'm told is > gr> easy to define Odd or Prime types in haskell). And even if agree that it > gr> may converge on what we have now, I still see a great value in crash > gr> early behaviour and documentation. > gr> I'm not the one to revolutionize ruby, I just want a slight enhancement :) > > so why not add simply "assert_type" statements. Thats what python is > doing and doing well. It's about forcing the use not adding extra > syntax. > > As a Tool writer i can tell you that many things could be done with this > optional type declaration. > > It's just the chicken egg problem of Open Source Software: > No one wants to use it until they see an advantage and no one > writes something to show them the advantage. > some python frameworks are doing it (zope, twisted, peak, actually most anything 'enterprisish') but Guido still did not pronounced himself on optional typing in python3k (IIRC he said it will be there, but is yet unknown *how*). Anyway, notice that I submitted RCR280 wich actually allow you to give type assertions if you want them: # if you want adaption: def sum a,b a=a.as Numeric; b=b.as Numeric a+b end # if you want assertion: def sum a,b a.as Numeric; b.as Numeric a+b end # if you don't care def sum a,b a+b end http://rcrchive.net/rcr/show/280