[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Are my metaprogramming underpants showing?

Daniel Sheppard

12/8/2005 9:06:00 PM

> Given that the code below is functionally equivalent, what's
> beneficial about using a lambda expression? It strikes me as a
> requirement imposed by using the Functor class more than anything.

The class way is definitely the way to go, as it gives you easier flexibility. I was just in a lamdba mood at the time I wrote it and couldn't be bothered making it into a class.

You might want to do this:

class Flickr
instance_methods.each {|x| remove_method(x) unless /__.*__/ === x }
end

To prevent any conflict between flickr methods and ruby object methods.








#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################
1 Answer

Matthew Smillie

12/9/2005 12:15:00 AM

0

On Dec 8, 2005, at 21:05, Daniel Sheppard wrote:


>> Given that the code below is functionally equivalent, what's
>> beneficial about using a lambda expression? It strikes me as a
>> requirement imposed by using the Functor class more than anything.
>>
>
> The class way is definitely the way to go, as it gives you easier
> flexibility. I was just in a lamdba mood at the time I wrote it and
> couldn't be bothered making it into a class.
>
> You might want to do this:
>
> class Flickr
> instance_methods.each {|x| remove_method(x) unless /__.*__/ === x }
> end
>
> To prevent any conflict between flickr methods and ruby object
> methods.
>

Good idea, since a conflict would break the whole thing.

Thanks again to you and Trans for the feedback.

matthew smillie.