[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Typed Parameters

Robert Dober

4/2/2006 7:02:00 AM

On 4/2/06, Austin Ziegler <halostatue@gmail.com> wrote:
>
> On 4/1/06, Robert Dober <robert.dober@gmail.com> wrote:
> > Dear group
> >
> > there was a recent thread about "Boolean" and it braught me to my
> > favorit thing I would love to have in Ruby2.
> >
> > *typed parameters*
>
> This might happen, but it's unlikely to work the way you have
> suggested. I personally hope it doesn't happen, as it will make
> Ruby a little less "smart."
>
> > My code is completely filled with things like this:
> >
> > def never_saw_a_better_method( clever, smart, stupid )
> > assert_type clever, String
> > assert_type smart, Hash
> > assert_type stuoid, Boolean
> > ....
> > def cool( clever : String, smart : Hash, stupid : Boolean )
> >
> > and of course
> > def x(y) would be equivalent to def(x : Object )
> >
> > There is no other than practical reason to that, I found that this
> > kind of type assertion finds the most devious bugs in my code.
>
> It's not actually that practical, and such things end up making your
> code very much like C++ and Java.
>
> Ruby is smarter than that. Ruby can do more than that.
>
> Think in terms of what your object's required capabilities are instead
> of pretending that a class indicator is sufficient for that.
>
> -austin
> --
> Austin Ziegler * halostatue@gmail.com
> * Alternate: austin@halostatue.ca
>

Austin as I have the highes admiration to your contribution to the
community, these are claims without any evidence.
Would you care to provide some?
I'd really appreciate.

Robert

--
Deux choses sont infinies : l'univers et la bêtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.

- Albert Einstein