In article <3c06b2ed$0$31457$edfadb0f / dspool01.news.tele.dk>, MikkelFJ <mikkelj-anti-spam / post1.dknet.dk> wrote: > >"Phil Tomson" <ptkwt / shell1.aracnet.com> wrote in message >news:%byN7.676304$Lg.26112595 / sjcpnn01.usenetserver.com... >> >> I want to pass around objects of a type which respond to a method called >> 'run'. Optionally, they might respond to a few other methods, let's call > >This was crossposted while I posted the article on first class functions in >Ruby. >The above problem is exactly what would elegantly be handled by first class >functions. You'd just pass the run function directly instead of having to >create an object that respond to some named function like "run". If more >functions that run were desired, it might be better to create a class, or a >list of functions could be passed in a hashtable. > >I think this shows the OOP is great, but there are other concepts that are >also worthwile. > I don't think it would work in this case. I need an object because there is potentially a lot of state information that needs to be passed along as well. In addition, I could forsee users of the system (programmers) creating classes which would also have a lot of utility functions in addition to 'run'. Phil