| C |
int a, b, c; |
In C, a, b and c are integers --
a type built right into the language. The plus sign is a plus operator,
built right into the language. |
| Ruby |
a = b + c |
In Ruby, a, b and c are objects
of the Fixnum class. The
plus sign is a method of the Fixnum
class. |
| C |
strcpy(s, "Hello World"); |
In C, the syntax is generally functionname(operand). |
| Ruby |
s = "Hello World" |
In Ruby, the syntax is generally
operand.functionname().
The difference is hardly earthshaking from the application programmer's point of view. Underlying this slight syntax difference is the fact that all operands are objects, and therefore can have methods built right into their classes. This eliminates the need to have, for instance, functions print_graphic(), print_calendar(), and print_musicscore(). Instead, classes graphic, calendar, and musicscore can each have their own print() method that knows exactly how to print that type of object. Once again, from the application programmer point of view, the fact that all Ruby variables are objects simply requires slight syntax changes, but it's not an earthshaking paradigm shift. |