Rasputin wrote:
> 
> Think of it this way.
> 
> When I want a speech synthesis feature added
> to my application, do I *really* want to add a String#speak
> method or a Synthesiser#say method?


No, but you might want some_string.puts( SynthIO )

Now your app can be used by a blind person simply by configuring a 
different IO object. All the calls to string.puts will work.  No?

> 
> What about when I want morse code? Or smoke signals?
> Does String need to have a render_as_gif method?


Why not pass the string an object with a known interface?
In all the above cases, if you have an object that responds to the same 
messages as IO then you can have as many output formats as you like.

> 
> And then when I don't need the morse code functionality, do I just
> stop requiring smoky.rb or do I go through and hack the String class?
> Don't forget anything else you might want to print - Fixnums, Arrays,
> serailised digital representations of Willy Rushton, etc, etc.
> 
> Maintenance nightmare.
> 
> I did think your hack to add this into String was great though,
> so maybe the above problems don't apply with Ruby  :)

Though this discussion may not be such an example, I wonder how much of 
software development dogma is predicated on unspoken assumptions 
dictated by a language.  For example, the idea that a message sent to an 
object always maps to a single, existing method in the reciever.  Or 
that messages are only sent to one object at a time, or that all 
recievers must be known in advance.  Or that messages and objects are a 
good thing.

For Ruby, whether print or puts belongs, in the core language, to IO or 
String is perhaps a moot point, since in actual application code it can 
go where circumstances best suggest.

> 
> Allen Holub is a top author, his 'C Companion' is one of
> those books I trawl eBay on a regular basis for. But I think he's
> being a touch fundamentalist in this case.
> 
> As Malacalypse the Younger would say : 'Death to all fanatics'!

I think I prefer George Bernard Shaw's line about unreasonable men. :)

James

http://www.bartleby.com/66/18/53618.html

>