Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Kernel.y and yes,yes,yes not least surprise

Thread Tools

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

Jamie Herre
Posts: n/a
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 )
YAML::dump_stream( o, *x )

_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.

Reply With Quote
why the lucky stiff
Posts: n/a
Jamie Herre ((E-Mail Removed)) wrote:
> I propose that Kernel.y should demand at least one argument

Yeah, whoa, I just committed. Thanky.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
rescue and principle of least surprise matt neuburg Ruby 1 02-17-2009 01:12 PM
Conventions in ruby and the principle of least surprise Einar Boson Ruby 6 02-02-2009 04:44 PM
Need regular expression for at least 7 characters and at least 1 special chatacter AAaron123 ASP .Net 0 10-03-2008 01:25 PM
JDBC and surprise with scrolling chris Java 1 08-19-2003 05:27 PM
String#split(' ') and whitespace (perl user's surprise) Mike Stok Ruby 4 06-27-2003 04:03 AM