From: George Ogata Date: 2005-02-17T05:44:51+09:00 Subject: Re: [ANN] FaceToFace 0.1.0 benny writes: > Benny is happy to announce his first published piece of software: > "FaceToFace" available as gem. > > > Dear list, > > I hope this is useful for someone and I am curious what you think about it. > > The code itself is no big deal and always open for improvements (as my > english is). > > = Overview > > FaceToFace aims to standardize the conversion and messaging > between classes and objects. > > You may think of it as syntactic sugar and as duck-typing taken to > the next level (imagine two ducks face to face, none of them being a real > duck). > > Up to now we had to remember each method that converts to a > certain class, e.g. 'to_i' converts to Integer, 'to_s' converts to String > etc. > > With FaceToFace you only have to remember one method and > you need to know the class to convert to, e.g. > 5.to(String ) #=> "5" > "6".to( Integer ) #=> 6 > > That way you could double-ducktype, i.e. you may not care > about the class of any object you convert to or from, e.g. > def double_duck_me( duck1, duck2 ) > duck1.to( duck2.class_name ) > end > > Instead of using to() you could also use from() to access the result of a > conversion, e.g. > Array.from( "test" ) #=> ["test"] > String.from( 4 ) #=> "4" > > [etc.] Have you seen http://rcrchive.net/rcr/show/280 ? There might be ideas for you in there.