Kernel.y and yes,yes,yes not least surprise

Sometimes using emacs makes me think of Molly Bloom (never a good idea at work) and then I just answer yes even before the question is asked. Today this resulted in a confusing bug.

h.each{ |k,v|y

did not produce an error but rather caused my script to output a bunch of "---"'s.

I propose that Kernel.y should demand at least one argument

def y(o,*x)
  puts( if x.empty?
      YAML::dump( o )
      else
      YAML::dump_stream( o, *x )
      end
    )
end

_why what do you think?

maybe the convention that all one letter methods demand arguments might even be considered for inclusion in the ruby style guide.

Yeah, whoa, I just committed. Thanky.

_why

···

Jamie Herre (jlst@gettysgroup.com) wrote:

I propose that Kernel.y should demand at least one argument