foo()
is equivilant to foo
Also, code blocks are specified outside the function argument list. Something that looks like this in javascript: foo(a,b,c,d,function() {
console.log("some callback")
})
would look like this in Ruby: foo(a,b,c,d) do
puts "some callback"
end
or even just: foo(a,b,c,d) { puts "some callback" }
That last one isn't a function definition.. it's a function call equivalent to the example before it.It's mostly the fact that it -looks- cleaner in all the right places that makes it appealing. That and the massively powerful web framework built on top of it.
Basically this is another way to make your loop looks nicer but nothing more.
You could argue this case if the language in the topic is something like LISP or Haskell compare to the C-based languages.
Yes, Ruby is dynamic. It's so dynamic that you have open classes so you can dynamically insert methods. It has deep introspection. It has closures. It has #method_missing which lets you do some interesting things. Basically, Ruby is just powerful enough, just over that tipping point, so programmers wind up doing metaprogramming (programs that write programs) more than they would in other languages. I'm sure Paul Graham has an article or two on the power of languages (smiley face here), and in at least one of them, he suggests that some people might mistake Ruby for a dialect of LISP.
See why_the_lucky_stiff's tutorial on D&D metaprogramming (Dwemthy's Array section at http://qa.poignantguide.net/chapter-6.html) and Rich Kilmer's use of Ruby for an aircraft management DSL (you'll have to google for that example). It's not that metaprogramming is impossible in C/C++ because you could always build a whole mechanism from the ground-up. (In other words, at some point you can claim that all these languages are Turing equivalent if I remember correctly.) The point is that some languages make interesting ways of programming easier, and when you hang out among the practioners of that language, you begin to see different ways of coding. This is why I've got Erlang on my TODO list, if I can squeeze it in my schedule.
is equivalent to
foo "
Man, I hate that 'feature' of Ruby. In Python, foo is the function, foo() the result of calling it. So much cleaner.
Objective C is fully dynamic. Typing is entirely optional. If you give every type declaration the type 'id', it's effectively the same as using 'var' in e.g. javascript.
I'm not sure what you mean by C-based, but I'm guessing ObjC would fall in your definition.