[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Best name for "this method" ?

Peña, Botp

9/28/2004 9:54:00 AM

Gavin Sinclair [mailto:gsinclair@soyabean.com.au] wrote:

> Elegant solutions are generally well
> factored, rather than expanded all over the top level. One
> should aim to keep like things together, and different things apart.
>
> There are two possible factorings. Have Object#methods
> return a specialised object, thus:
>
> foo.methods.private
> foo.methods.all
> foo.methods.new
> foo.methods.singleton
> foo.methods[:new, :protected] # if you need combination
> # etc.
>
> The other possible factoring is as above:
>
> foo.methods(:new)
> foo.methods(:private)
> foo.methods(:singleton, :private)
> # etc.
>
> Aesthetically, I think I prefer the top one. But even the
> second one is far preferable to the current state of Ruby, to my mind.
>
> In general, you dislike using symbolic arguments to tune a
> method's behaviour. I like it, and consider it quite
> consistent with the general practices of good programming.
>

+1

> Cheers,
> Gavin

kind regards -botp