--- Brian Schröäer <ruby.brian / gmail.com> wrote:

> > [snip]
> > 
> > I think that every time we visit this subject, it goes back
> to
> > similar arguments as to why every object doesn't have puts,
> > such as  "fred".puts. Matz has made statements on this
> > which I agree with. Personally I think that puts("fred") is
> more natural.
> > 
> 
> We don't have puts, but we have display
> 
> irb(main):005:0> 12.display
> 12=> nil
> irb(main):006:0> [1,2,3].display
> 123=> nil
> irb(main):007:0> "a string".display
> a string=> nil

I forgot about that one.  This would be great to override if
the object was a big datastructure and you could easily write
it out a chunk at a time rather than convert it to one massive
string first.  But, I haven't seen anybody use this or override
it.

The complement to the this obj.display(io) method would be a
klass.read(io) method, but it gets even harder to do than the
klass.from_s(s) of my proposal because you don't know how much
to read from the io (what would String.read(io) do? - maybe
stop at a newline?).  At some point you just have to go to
traditional parsing.  But, maybe it is still useful.  I don't
know.



		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com