What does /prog/ think about Ruby?
I've been doing a lot of reading on the language, and I find it very verbose, the code is very literal.
I'm particularly interested in the Rails aspect, as webdev is quite a hobby of mine.
Name:
Anonymous2011-02-10 2:59
Ruby is the most object-oriented of the common languages, since literally everything is an object, there are no primitives. You can do some pretty nifty things with it, like monkey-patching, metaprogramming, etc., since it's interpreted and heavily dynamic. However, it's also slow... very, VERY slow. (http://shootout.alioth.debian.org/u64/which-programming-languages-are-fastest.php) They say "just write speed-critical code in C," but that's a cop-out; why should I use it when other languages can run with decent speed without resorting to writing it in C?
Name:
Anonymous2011-02-10 3:16
Well >>2 I suppose that's the trade off you make for being able to write such beautiful and concise code.
Thanks for the link!
>>1
# This is a block. It can be passed to a function like so `function your-block' and is called within that function with `yield your-bar'
{|bar| bar.foo}
# This is a proc. It is called like so `your-proc.call' and it can be assigned to a variable or passed to a function directly.
proc {|bar| bar.foo}
# This is almost the same as a proc.
lambda {|bar| bar.foo}
# This is a method. It is called like so `foobar.baz your-bar' and it can't be passed to a function directly.
def baz(bar)
bar.foo
end
Such is the elegance of ruby.
Name:
Anonymous2011-02-10 9:18
>>10
You're an idiot. My point was that the way ruby does it is extremely retarded and the obvious way to go is have one way to do it that covers all of that.
Name:
Anonymous2011-02-10 9:29
>>12
Having blocks be syntactic sugar for a lambda would be perfectly fine.
Having them be a weird hack that is not compatible with lambdas is extremely stupid. (You can't define a function to use a block and then call it with a proc or vice versa, at least not without some changes like the ampersand)
Also not having a sensible way to pass a method to a function is pathetic. Even python can do that and it doesn't claim to be an acceptable lisp and whatnot.
What does /prog/ think about Ruby?
Ruby is:
- when OOP replaces common sense;
- when people write "begin end begin begin end end..." instead of code;
- when program is so slow, that you can have a tea party, while it multiplies two 10x10 matrices;
- when code like 12.5.integer? or 3.times {puts "Ruby rocks!"} considered beautiful.