Ruby is rapidly gaining in popularity. Eiffel and O'Caml are niche languages, but employ some different approaches than you'll see in the boring world of VB, C++, Java, etc. As a result they're what I would call "eye opener" languages, and knowing them will give you a broader knowledge and understanding (the two are not the same) of programming.
Eiffel is a purely object-oriented language with a very strict type system. It employs multiple inheritance, which aside from C++ is rather lacking in the mainstream. The difference is that Eiffel makes multiple inheritance a breeze to use, whereas it's troublesome in C++. Eiffel provides a beautiful system of constrained generics, somewhat similar to C++ templates but easier to work with. It also employs a novel strategy to make exceptions easy to work with called Design by Contract, where conditions can be checked before and after running routines. This tactic allows the source of bugs to be tightly contained.
O'Caml likewise is object-oriented, though not everything in O'Caml is an object. It provides multiple inheritance, and uses a different method for resolving the problems with MI, but still comes out leagues ahead of C++. Perhaps the biggest advantage of O'Caml is its type inference mechanism. One need (almost) never specify the type of a variable, but O'Caml will still figure it out and enforce type checks. As a result, programmers end up typing far less "boilerplate" code.
Both, when properly compiled, can equal or exceed he speed of compiled C code, and the compilers necessary to do so are freely available for both languages.
Ruby is the sweetspot, though, I think, of theoretical purity, practicality and popularity It's purely object-oriented in the same way Smalltalk is, but beginners need not immediately worry about that and can program in a more procedural or functional manner.
Interestingly, all three employ what might be considered by some a Pascal-esque syntax.
I provide "Hello world!" in all three (each implements a function or procedure which prints the classic greeting):
Eiffel:
Code: Select all
class HELLO_WORLD
creation { ANY } make
feature { ANY }
make is
do
say_hello_world
end
feature { NONE }
say_hello_world is
do
std_output.put_string("Hello world!")
std_output.put_new_line
end
end[code]
O'Caml:
[code]let say_hello_world () = print_endline "Hello world!"
say_hello_world ()[code]
Ruby:
[code]def say_hello_world
puts "Hello world!"
end
say_hello_world[code]
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:1444, old post ID:21980[/size][/color]