Live data from Hacker News

Ruby Is The Future

enfranchisedmind.com

31–40 of 56 posts

Re: Ruby Is The Future

#31
post #8
post #4

Earlier quoted context omitted.

As noted in Werner Schuster's article, many languages (such as C# or Scala) do support type-safe, non-ambiguous, non-conflicting extension of existing classes, demonstrating that extension of existing classes can be safely implemented and does not require the use of dangerous monkey-patching.

dealing with the type system in scala can be a pain and is a hit to productivity in the early stages. The question is if the hit in the early stages leads to more productivity in the later stages. I'm not convinced that it does. I've done a lot of ruby, and I've had monkey patching bite me a few times. However, fixing the problem was never that hard (two days max) and is clearly overshadowed by the productivity gaine…

I find monkeypatching happens because the framework doesn't utilize proper baseline OO techniques. By "baseline" I'm excluding mixins. I have rarely found a case where mixins do a better job over well factored inheritance. I don't think mixins are "evil". Just over utilized and inheritance heavily underutilized in Ruby.

Re: Ruby Is The Future

#32
post #26
post #18

Earlier quoted context omitted.

I love Ruby. I love that code can be so short and yet easily readable. It might be slower and perhaps more memory-hungry than other languages, but for my needs that's usually not an issue. What I do miss are good, well documented , stable libraries. For example, I currently process RSS/Atom feeds with FeedTools, whose own creator says he's tired of maintaining (I totally understand him and am extremely thankful for t…

"I mean stuff like having better documentation, for example, online, free, in googleable format" Do you mean for the core language? Are you not happy with http://www.ruby-doc.org/ ?

Plus you can do a custom Google search like this:

      http://ruby-doc.org/q/

Re: Ruby Is The Future

#33
post #29

Earlier quoted context omitted.

Which version of C# are you thinking of? In C# 3, the verbosity level is much less than in C# 2, where it's slightly less than C# 1. I don't see where Ruby syntax is particularly more concise than C# 3's. Well, let me clarify "particularly". I don't find myself feeling like I'm suffering under C#'s syntax, relative to Haskell's. It has about the same amount of syntactic overhead: writing types for method parameters,…

"I don't see where Ruby syntax is particularly more concise than C# 3's." 1.upto(10).each{|x| print x} I'm curious - how would you print 1 through 10 in C# 3 by comparison?

I still find this clearer:

  for x in range(1, 10): print x

Re: Ruby Is The Future

#34
post #29

Earlier quoted context omitted.

Which version of C# are you thinking of? In C# 3, the verbosity level is much less than in C# 2, where it's slightly less than C# 1. I don't see where Ruby syntax is particularly more concise than C# 3's. Well, let me clarify "particularly". I don't find myself feeling like I'm suffering under C#'s syntax, relative to Haskell's. It has about the same amount of syntactic overhead: writing types for method parameters,…

"I don't see where Ruby syntax is particularly more concise than C# 3's." 1.upto(10).each{|x| print x} I'm curious - how would you print 1 through 10 in C# 3 by comparison?

One way to do this in Scala:

  def print[T] (value:T) = System.out.println(value)
  1.until(10).foreach(x => print x)
This is a fairly uninteresting example, however. Something more interesting would be, for instance, the use of structural types to implement type-checked duck typing.

Scala example:

  // Declare a structural type for any class implementing close()
  type Closable = {def close(): Any}
  
  // Executes the provided function with the given
  // closable generator, creating a new instance which
  // will then be closed on completion. The provided
  // function's value will be returned.
  def withClosable[T, C  C) (f: (C) => T) = {
    val closable = c
    try {
      f(closable)
    } finally {
      closable.close
    }
  }
  
  // Example usage
  def usage = {
    val updated = withClosable(db.openConnection) { conn =>
      conn.update("INSERT INTO example VALUES (...")
    }
    System.out.println("Rows updated: " + updated)
  }
This could be compared with Python's new 'with' syntax.

Re: Ruby Is The Future

#35
post #6
post #5

Just two words: "Hopefully not..."

Why? Because of monkey patching, syntax, performance, the community or some other reason such as you prefer Python or have an intuitive, ineffable and unexpressable disklike of the language or because Matz is from Japan and they bombed Pearl Harbor?

(not the OP) I am still trying to like it, but my impression is that it is quite messy, and the documentation for Ruby is often bad.

Re: Ruby Is The Future

#36
post #29

Earlier quoted context omitted.

"I don't see where Ruby syntax is particularly more concise than C# 3's." 1.upto(10).each{|x| print x} I'm curious - how would you print 1 through 10 in C# 3 by comparison?

I still find this clearer: for x in range(1, 10): print x

Not so different in Ruby:

for x in 1..10; print x end

Re: Ruby Is The Future

#37
post #26

Earlier quoted context omitted.

"I mean stuff like having better documentation, for example, online, free, in googleable format" Do you mean for the core language? Are you not happy with http://www.ruby-doc.org/ ?

Plus you can do a custom Google search like this: http://ruby-doc.org/q/

Best thing I learned today. Thanks.

Re: Ruby Is The Future

#38
post #29

Earlier quoted context omitted.

"I don't see where Ruby syntax is particularly more concise than C# 3's." 1.upto(10).each{|x| print x} I'm curious - how would you print 1 through 10 in C# 3 by comparison?

I still find this clearer: for x in range(1, 10): print x

I'm nitpicking, but your range should be range(1,11).
Post reply on HN