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…
Ruby Is The Future
31–40 of 56 posts
Re: Ruby Is The Future
#32Earlier 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/ ?
http://ruby-doc.org/q/Re: Ruby Is The Future
#33Earlier 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?
for x in range(1, 10): print xRe: Ruby Is The Future
#34Earlier 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?
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
#35Just 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?
Re: Ruby Is The Future
#36Earlier 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
for x in 1..10; print x end
Re: Ruby Is The Future
#37Earlier 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/
Re: Ruby Is The Future
#38Earlier 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