From: Brian Candler Date: 2003-04-15T17:13:25+09:00 Subject: Re: using ruby reflection to generate code On Tue, Apr 15, 2003 at 10:25:55AM +0900, Doug Beaver wrote: > phil and i talked over private email about DumpNode, it looks promising, > at least for figuring out names and types of method arguments, maybe > even the return type. i also thought it might be possible to put > attr-like hints in the ruby code, so you could do: > > class Song > def play(track=0, duration=0) > args :track, Fixnum, :duration, Fixnum > retval :didPlay > > # try to play the track here, set didPlay to false if it didn't work > return didPlay > end > end Perhaps you could even treat them as assertions, e.g. assert(track.is_a? Fixnum) assert(duration.is_a? Fixnum) which are checked at runtime (in Ruby) but used as compile-time hints (for more static languages) Just a thought... Brian.