Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Ruby thread

Name: Anonymous 2013-08-06 1:50

What are the good and bad things about Ruby, in your opinion?

Name: Anonymous 2013-08-06 12:31

Good things:

Block syntax:

# do-end-example
File.open 'sicp.txt' do |file|
  puts file.read
end

[1, 2, 3].each do |number|
  puts number
end

# { } -example
[1, 2, 3].map { |x| x * 5 }

# I like this
[1, 2, 3].map(&:to_s)

[1, 2, 3].inject(&:+)


Blocks are also nice for creating some simple DSL:s

Also, doing meta programming with instance_eval, class_eval, module_eval, etc is nice.


that's it.

Bad things:

All those things starting with $ (like $$)

Minor version update can break existing program

Slow as fuck

require sucks

Syntax of calling lambda closures


#example: normal method
def m(a)
  a + 42
end

puts(m())
# or
puts m

#example: lambda
l = lambda { |a| a + 42 }

puts l.call()
# or
puts l.call
# or
puts l.()


Why the hell different hash syntaxes?


# one way (normal)
h1 = {:a => 'poop', :b => 'crap'}

# second way (faggot), only symbols are possible as keys

h2 = {a: 'poop', b: 'crap'}

#noob way
h3 = Hash.new
h3['a'] = 'poop' # symbols are too complicated for me
h3['b'] = 'crap'



Overall, I think Python is better.

There might be other goods/bads, but just now they won't come to my mind.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List