Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

About the static type system:

When people say they like Go's static type system sometimes they are comparing it to something more verbose like Java.

Think about someone that knows Python and have to use Java, then they think that all static type languages are as a pain in the ass. So they begin disliking static type systems when they really just hate the Java's one.

And so the moment they are using Python and start playing with Go they find a static type system they kinda like because it's less verbose and without so much ceremony.



> When people say they like Go's static type system sometimes they are comparing it to something more verbose like Java.

Go's system throws out a lot of the ceremony of older Java, but also throws out a lot of the benefit; many modern languages (including recent Java) also use type inference and other features to reduce static typing ceremony, but retain at least the power of the classic Java type system, and often far more.

Go's type system seems to be a poor benefit-to-ceremony trade-off.


Java the language is verbose, sure... but the type system?


Well, having a static type system is a tradeoff...

When using Python I feel the least resistance from the language, you can do a lot with a little code. Problem is, when the system grows you begin to miss the checking that static typing provides (esp. when doing refactors).

When coding in Go I feel that there is a little productivity lost upfront, but when your script begins growing and starts to look like a "serious" project you feel more confident changing your old code. This is because some kind of errors are caught by the type system before doing manual/automated testing.

And I'm talking about personal projects where I'm alone, this could be more important in projects with several coders.


I think yupyup is referring to the fact that all types must be explicitly annotated.

(I favor this and explicitly annotate most of my types in Haskell and Scala. Makes reading easier. But I did occasionally find it annoying in Java when it was mandatory.)


Inferred types are nice.

They make cleaner, and therefore, more readable code. That is the main thing people want from dynamic typing anyway. It's really not very common to change the type of a variable, and a statically typed codebase is more predictable, and therefore easier to manage.




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

Search: