Jimmy Nilsson
Posts: 694
Nickname: jimmyn
Registered: Aug, 2003
|
Jimmy Nilsson is a developer, author and trainer for JNSK in Sweden.
|
|
|
|
Value Safety
|
Posted: Feb 15, 2008 5:35 PM
|
|
|
This post originated from an RSS feed registered with Agile Buzz
by Jimmy Nilsson.
|
Original Post: Value Safety
Feed Title: Jimmy Nilsson's weblog
Feed URL: http://www.jnsk.se/weblog/rss.xml
Feed Description: Patterns, OO, DB, .NET, ...
|
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Jimmy Nilsson
Latest Posts From Jimmy Nilsson's weblog
|
|
While listening to my colleague Niclas Nilsson's presentation called "Dynamic Languages for Statically Typed Minds" last week at
PBT Group in Cape Town it occurred to me that what
Dynamic Languages lack in type safety, they gain in *value* safety.
:-)
Niclas showed that in static typed languages such as Java and C#, if you instantiate an int with 100000000 (one hundred millions) it's still an int. If you then multiply that int by itself
and store it in the same int, it's still an int, but the value is 1874919424. Doesn't look right, does it?
If you do the same in Ruby, instantiate a member with 100_000_000, it's a FixNum. If you multiply that FixNum by itself, it becomes a BigNum. But the value is 10000000000000000 which seems
to be more correct than in the Java/C# case. Type safety? No, but Value safety!
Read: Value Safety
|
|