From: Josh Cheek Date: 2011-04-08T21:52:41+09:00 Subject: Re: "of" keyword? inverse dot syntax... --bcaec501631f461ed104a067a5bc Content-Type: text/plain; charset=ISO-8859-1 On Fri, Apr 8, 2011 at 3:34 AM, Julian Leviston wrote: > Hi, > > Consider this: > > some_data.to_s.split("\n").each{|item| puts item} > > how about an alternative syntax for the dot operator: > > each{|item| puts item} of split("\n") of to_s of some_data > > or, more intelligently: > > this_school.students.addresses.map{|address| a.all_as_one_sentence} > > map{|address| all_as_one_sentence of address} of addresses of students of > this_school > > Just wondering if this is a possibility? :) > > julian. > I don't think my brain would be very fond of this, I like starting with the thing I know and applying a series of transformations to it via methods to turn it into the thing I want. I feel like I'd have to keep jumping to the right to see what I have, and then back to the left to see what I'm doing to it. join of map(&:name) of students join of map(&:name) of courses They are the same until the very end, so you can't know what you're talking about until after you're done talking about it. But maybe if I experienced I'd become more familiar some way of thinking that fits better with this syntax. Maybe in practice, it would only be used in situations like `name of student` where it feels natural and the context is straightforward, and not in situations like `join of array` where join is an action rather than an attribute. IDK, I'd try it out if someone went and did it, but I don't think I'd advocate that someone put forth the effort to do it otherwise (though it might not be very difficult, might just require a handful of lines of yacc or something) --bcaec501631f461ed104a067a5bc--