Live data from Hacker News

The advantages of static typing, simply stated

pchiusano.github.io

31–40 of 127 posts

Re: The advantages of static typing, simply stated

#31
post #3

Earlier quoted context omitted.

Have you considered the possibility instead that JSON is not an appropriate serialization protocol or storage mechanism for the problem to be solved? Or that it isn't being used effectively/correctly (that is, it isn't being parsed correctly, e.g. with a library or some other mechanism that makes checking underlying types less cumbersome)? I noted in a comment downstream from here that plenty of C and C++ JSON librar…

Have you worked with a public api in the last few years that didn't depend on json?

'Everybody else is doing it' is insufficient justification to keep on doing it.

As it happens, I agree that JSON is probably a long-term mistake, although it is definitely an improvement over XML, the previous player in that space.

Re: The advantages of static typing, simply stated

#32
post #25

Newbie starts with C++, moves on to Haskell after a very brief dabbling in some dynamic languages, and comes out thinking expressive static type systems are great. No great surprise, no real insight. The purpose of programming languages is to bridge the gap between ideas and execution. The purpose of a type system is to prove something about the code; astute readers will notice that this is an orthogonal concern. Sta…

The arrogance (and inaccuracies) in your first paragraph are unnecessary

Re: The advantages of static typing, simply stated

#33

My disagreement starts with the beginning of this: "A large class of errors are caught, earlier in the development process, closer to the location where they are introduced." I would re-state this as: "A large class of errors are introduced, which otherwise would not exist." Consider dealing with JSON in Java. Every element, however deeply nested, needs to be cast, and miscasting leads to endless errors, elsewhere in…

Abstract over and guard against external messy systems at the boundaries. Static types help with this just as much as enforcing invariants and consistency, at least with a good language.

Re: The advantages of static typing, simply stated

#34

It's frustrating that this static vs dynamic 'battle' still goes on. The longer everyone thinks this is actually a problem, the longer we have to wait for innovations to happen. Look at the web in 2016, the technology is a complete disarray. Look at the game industry in 2016, where C++ is thrown around as the the cause and solution to all life's problems. A language created 33 years ago now with no intention of being…

Regarding your last sentence, part of Alan Kay's motivation for OOP with SmallTalk was that he filt that type systems were limiting because they never anticipate all the possible types a program will need.

Re: The advantages of static typing, simply stated

#36
Interestingly, most of these advantages are not specific to static typing, but derive from having a language that talks about types – even a dynamic one. For example, most of these advantages apply to Julia as well, a dynamic language that has type declarations, which:

- Lets you create typed collections so that if you insert the wrong kind of value, you get an error immediately, albeit only when code runs, not before;

- Has abstract types that serve the same function as Haskell's type classes, and allow you to inherit a huge amount of functionality for a very brief type definition;

- Serve as documentation of APIs;

- Allow performance similar to C/C++.

Another advantage that wasn't listed is that in languages that don't allow type annotations, you end up writing a lot of boilerplate type-checking code in libraries to give better error messages.

Re: The advantages of static typing, simply stated

#37

My disagreement starts with the beginning of this: "A large class of errors are caught, earlier in the development process, closer to the location where they are introduced." I would re-state this as: "A large class of errors are introduced, which otherwise would not exist." Consider dealing with JSON in Java. Every element, however deeply nested, needs to be cast, and miscasting leads to endless errors, elsewhere in…

Sorry to say this but you're talking out of your ####.

All the research from expiercal studies mostly all show that static vs dynamic languages all correlated with a Expertise reversal effect. This is for beginners not experience programmers. That at the start of the studies for the first 8 to 9 months novices have a negative correlation with the speed of development work with a statically typed language. After 8 to 9 months they gain a singificant boost from static type language.

Source to backup my statement and resource if you're interested @ Susan_hall

Functional Geekery Episode 55 – Andreas Stefik https://www.functionalgeekery.com/episode-55-andreas-stefik/...

Secondly another study that was published for Polymorphism in Python from the website (neverworkintheory)

Polymorphism in Python http://neverworkintheory.org/2016/06/13/polymorphism-in-pyth...

Gives the qoute: `Our findings show that the receiver in 97.4% of all call-sites in the average program can be described by a single static type using a conservative nominal type system using single inheritance. If we add parametric polymorphism to the type system, we increase the typeability to 97.9% of all call-sites for the average program.`

I could qoute other resources to backup my statements though if you want to have a skype coversation I'm up for a talk.

Re: The advantages of static typing, simply stated

#38
post #3

Earlier quoted context omitted.

Have you considered the possibility instead that JSON is not an appropriate serialization protocol or storage mechanism for the problem to be solved? Or that it isn't being used effectively/correctly (that is, it isn't being parsed correctly, e.g. with a library or some other mechanism that makes checking underlying types less cumbersome)? I noted in a comment downstream from here that plenty of C and C++ JSON librar…

We have no control over the API that we draw from. We are drawing from the API of a different company. I wish they didn't use JSON. If they have to use JSON, I wish they at least enforced a consistent schema. But they don't. And that is why static type checking fails: because the real world is chaotic, and when you have to interact with that real world, you are often forced to do so dynamically, because of the mistak…

You're insisting on an assertion that the experience of many of us directly contravenes. It's not the best way to make a point.

Re: The advantages of static typing, simply stated

#39
post #13

Why are we even still having this debate in 2016? The question is not if strong types are better but how to migrate existing codebases to those languages. I'm an OCaml guy myself but Swift looks pretty nice...

Because not everyone agrees in 2016? I wasn't aware that the debate had ever been settled. Seems like it's been going on for decades.

Re: The advantages of static typing, simply stated

#40
post #30

Earlier quoted context omitted.

Partly because people still get mixed up between strong typing (something without any clear definition) and static typing...

I'm not aware of any universally accepted definition of "strong typing"

No implicit conversions?
Post reply on HN