News for hackers. Stuff that matters.
Re:Ask HN: Why choose a dynamically typed language? by anamax on Sunday August 08, 2010 @12:59AM (#1584892)
> When I look at a method declaration, I want to know that it only works with integers, the same way I look at a field in the database I want to be sure to expect only integers, and nothing else.

That's fine, but it doesn't help me with the errors that I make.

I don't make representation errors. I make kind errors. The difference is that the number of apples and the number of bananas are both non-negative integers, but a check for non-negative integers doesn't keep me from adding apples to my bananas inventory. Remember that I do want to add both apples and bananas to my fruit inventory.

Yes, I care about representation, but things shouldn't go south if I happen to have half an apple.

Re:Ask HN: Why choose a dynamically typed language? by aristidb on Sunday August 08, 2010 @07:48AM (#1585233)
In some statically typed languages, it is possible to have an "Apples" and a "Bananas" type. And it's good to hear that you don't make "representation errors", because I do make these errors - which then blow up precisely after 3 hours of running the Python program.
Re:Ask HN: Why choose a dynamically typed language? by pbz on Sunday August 08, 2010 @12:32PM (#1585577)
No quite sure what you mean, if you write something like this:

void DoSomething(Fuit fruit, uint quantity) { .. }

Inside that method you will be guaranteed to receive only apples or bananas and a non-negative integer for quantity.