Hacker News new | past | comments | ask | show | jobs | submit login

The comments in the article you linked dismantle most of the arguments made.

From one of the comments:

https://dev.to/aussieguy/the-non-broken-promise-of-static-ty...

> The article covers a study of the same name. In it, researchers looked at 400 fixed bugs in JavaScript projects hosted on GitHub. For each bug, the researchers tried to see if adding type annotations (using TypeScript and Flow) would detect the bug. The results? A substantial 15% of bugs could be detected using type annotations. With this reduction in bugs, it's hard to deny the value of static typing.

> Yes, I'm sure the LOAD instructions take pictures of cats as operands via their typeless instruction sets... What in earth are you on??

Have you written any assembly? Assembly generally has no or very rudimentary type checking, you're generally dealing with words/bytes and addresses, you can arithmetically add parts of strings, divide pointers, etc. Errors due to these operation will surface at runtime, not be typechecked.

> well once someone does that let me know.

You can use void pointers as return types and arguments for all functions in c code. The effect is significantly less type checking while having equivalent performance.




"A substantial 15% of bugs could be detected using type annotations. With this reduction in bugs, it's hard to deny the value of static typing."

Actually, that makes it really easy to deny the value of static typing. If the total number of bugs in dynamic and static code is the same. But some bugs in dynamic code would be caught by static typing checking.

We most conclude that adding static typing results in a large number of non-typing related bugs being added to the code base. It's simple maths.

"Have you written any assembly?" Yes, I'm an emulator author, thank you very much.

The registers and opcodes are typed with things such as u8, u16, u32, u64, i32, i64 and only work with data of the right type.

"arithmetically add parts of strings, divide pointers" You mean standard C stuff, you know the statically typed language.

"You can use void pointers as return types and arguments for all functions in c code" Dynamic types is not the same thing as type eraser. That void pointer doesn't carry the information that it points to a picture of a cat for example.

The fact you don't understand the difference between a void pointer and dynamic typing doesn't exactly surprize me. It's more like a giant vtable.


> If the total number of bugs in dynamic and static code is the same.

Completely baseless assumption.

> Yes, I'm an emulator author, thank you very much.

Ahahaha let's have a link then.

> The registers and opcodes are typed with things such as u8, u16, u32, u64, i32, i64 and only work with data of the right type.

Those are sizes, not types, and the same opcode generally applies to signed and unsigned integers. You consider that to be a static type system and you think the purpose is performance and not correctness? Lol

> You mean standard C stuff, you know the statically typed language.

You're trying to debate against the need for static typing by pointing out unsafe parts of c? Ahaha

> That void pointer doesn't carry the information that it points to a picture of a cat for example.

First of all you can totally carry around runtime type info and value with a single void pointer. Not to mention many dynamically typed languages have type erasure and many statically typed languages have runtime type info. Also, you've claimed multiple times that there's no need for type checking whatsoever. You need runtime type information at runtime now?




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: