From: Gordon Thiesfeld Date: 2008-02-22T03:52:08+09:00 Subject: Re: Kernel#putc vs. $stdout#putc On Wed, Feb 20, 2008 at 7:54 PM, Arlen Cuss wrote: > Not quite: > > static VALUE > rb_f_putc(VALUE recv, VALUE ch) > { > return rb_io_putc(rb_stdout, ch); > } > > Kernel#putc here passes to IO#putc anyway, which then (as you mention) uses > IO#write. > OK, here's why I'm confused. In the code below, why isn't the output of both of the putc methods 42? class ChunkyIO < IO def putc(int) write '42' end end $stdout = ChunkyIO.new(1,'w') putc ?K puts $stdout.putc ?K puts #outputs K 42