From: Daniel Berger Date: 2005-05-23T11:25:21+09:00 Subject: Re: join not in Enumerable Ara.T.Howard wrote: > > > Also, every class except Array would have to have a custom definition of > > join, since there's no reasonable default behavior for any class outside of > > Array. > > really? > > set = Set::new > set.join ',' > > ll = LinkedList::new > ll.join '->' > > dll = DoublyLinkedList::new > dll.join '<->' > > v = BitVector::new > v.join '|' > > path = graph.shortest_path from, to > path.join '=>' > > string = String::new > string.join "
" > > stack = Stack::new > stack.join '-' > > rope = Rope::new > rope.join '_' > > priority_queue = PriorityQueue::new > priority_queue.join(','){|priority_and_obj| priority_and_obj.join ':'} > > come to mind ;-) Fine, replace "Array" with "most lists" and my point still stands. > > And if every class would have to implement its own version of a method, that > > method doesn't belong in a module. Modules are not interfaces. > > why would every class have to implement it's own? with the defintion we've > been throwing around we already have things like > > harp:~/build/ruby > ./ruby -e'html = "line1\nline2\nline3".join "
"; p html' > "line1\n
line2\n
line3" > > which is kinda handy and makes good sense no? No, it doesn't make sense. Regards, Dan