Joshua Boyd wrote:
On Thu, Oct 14, 2010 at 12:10:46PM +1100, Erik de
Castro Lopo wrote:
If you get serious about programming, its
important to
know more than just C and C++. For many tasks, garbage
collected languages with stricter type systems than C
and C++ are a better fit. Langauges like Python, Ruby,
Ocaml and Haskell. Even Java!!!
You say stricter type system, then Python and Ruby in the next
sentence. Does not compute. ;)
Python and Ruby do have a strict type system, its just that
the types are checked at run time. In these dynamically typed
languages, *every* value is an object that caries around with
it its type.
For instance this in Python:
Python 2.6.6 (r266:84292, Aug 29 2010, 12:36:23)
[GCC 4.4.5 20100824 (prerelease)] on linux2
Type "help", "copyright", "credits" or
"license" for more information.
>> x = 1
>> y = [ 1 , 2 ]
>> x + y
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'list'
The run time type checker is telling you that adding an integer to
a list does not make sense.
In (strict) statically typed languages like Ocaml and Haskell this
is a compile time error.
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/