From: Tim Pease Date: 2007-01-05T07:32:27+09:00 Subject: Re: Pervasive Methods [was: Little Things] On 1/4/07, ara.t.howard@noaa.gov wrote: > On Fri, 5 Jan 2007, Tim Pease wrote: > > > On 1/4/07, ara.t.howard@noaa.gov wrote: > >> On Fri, 5 Jan 2007, Trans wrote: > >> > >> > "Pervasives.send obj, message" IMO is too long. > >> > >> P = Pervasives > >> > >> P.send obj, message > >> > >> ?? > >> > > > > Why not get rid of Pervasives / P altogether and simply have some new > > keywords in the parser? > > shorter would be better alright. > > > > > send obj message > > id obj > > > > it __has__ to hang of another object otherwise > > class C > def foo > send :inspect # keyword or method? > end > end > Hmmm ... maybe I need some enlightening, but this is what I came up with ... > cat a.rb def if(*a) p a end if true then puts 'keyword 1' end if(true) puts 'keyword 2' end > ruby a.rb keyword 1 keyword 2 That's the beauty of keywords -- the parser is going to intercept them and invoke the appropriate function via the lexer. Unless I did not properly define my "if" method there. TwP