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

J

Jamie Herre

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top