From: Chris Carter Date: 2007-01-05T09:34:20+09:00 Subject: Re: Pervasive Methods [was: Little Things] I really think adding a new keyword, or way of calling methods is a bad idea, and a big code smell. Having the pervasive show something is different than the class might want you to think is good. How many times have you been confused by some of Rails' proxy arrays, I know I have been fooled many times, using the Pervasive in metaprogramming allows us to see what the class ACTUALLY is. On 1/4/07, Trans wrote: > > ara.t.howard@noaa.gov wrote: > > On Fri, 5 Jan 2007, Trans wrote: > > > > > Or maybe > > > > > > obj!send message > > > > that's pretty good. i was leaning towards a module so we could just try to > > write it as an extension now though... > > irb(main):003:0> class Object > irb(main):004:1> def p(obj=(not_obj=true;nil)) > irb(main):005:2> return Pervasives if not_obj > irb(main):006:2> super obj > irb(main):007:2> end > irb(main):008:1> end > => nil > irb(main):009:0> module Pervasives > irb(main):010:1> module_function > irb(main):011:1> def send(obj, *args, &blk) > irb(main):012:2> obj.send(*args,&blk) > irb(main):013:2> end > irb(main):014:1> end > => nil > irb(main):015:0> p "2" > "2" > => nil > irb(main):016:0> p.send("2",:class) > => String > irb(main):017:0> p.send "2", :class > => String > > Then go "p p" ;-) > > T. > > > -- Chris Carter concentrationstudios.com brynmawrcs.com