tags:

views:

171

answers:

1

What are the key differences between Ruby and C?

+9  A: 

They are almost totally different.

Ruby

  • Strong, dynamic typing
  • Purely object oriented
  • Automatic garbage collection and no pointers
  • Interpreted (or JIT compilation with JRuby/IronRuby)
  • Reflective
  • Supports functional programming (closures, coroutines, etc.)
  • No preprocessor or macros

C

  • Weak, static typing
  • Procedural (not object oriented)
  • Not garbage collected and has pointers
  • Compiled
  • No reflection
  • Does not support functional programming
  • Has a preprocessor and supports macros

To Ruby From C and C++

dbyrne
@dbyrne Nice! So, Ruby doesn't have memory leaks
72616b657368
@72616b657368: All languages can have resource leaks. Some languages just pick up after you more than others making such bugs less likely.
R0MANARMY
Note that Ruby can also be compiled completely ahead-of-time with JRuby or MacRuby. In any case, though, it is still substantially different from C in that there are many options in how the code is run.
Matt B.
Looks to me "reflection" is a strong feature in Ruby
72616b657368
@72616b657368 Reflection in Ruby is certainly powerful, especially when combined with Ruby's open classes. However, be careful to use these features sparingly and only where they make sense! "With great power comes great responsibility"
dbyrne