Live data from Hacker News

Typing Is Hard

3fx.ch

131–134 of 134 posts

Re: Typing Is Hard

#131
post #61

Earlier quoted context omitted.

Typescript taught me that I actually don’t care about types and all I care about is the shape of data. In most cases I think of types/interfaces in Typescript as strict data definitions. A function takes in a collection of data; as long as the data matches the shape I expect, don’t care what the data represents.

> Typescript taught me that I actually don’t care about types and all I care about is the shape of data. Seconding leafario2 here, that's exactly what types do: They give guarantees about the shape of data. Maybe what you meant was you don't care whether an object is of type Customer or Supplier , as long as it has an element/field named address . That's called "structural typing" (as opposed to "nominal typing"). Fe…

I don’t know if I do care that customer is or isn’t a supplier. I have been using Nominal type systems in C++ and C# for a long time and I’ve started drifting into an architecture style that leverages interfaces as my types which I just learned is structural typing. I really liked the concept in Golang and then I really started using it in TypeScript and got hooked. It makes so many programming problems easier to implement, maintain, and understand. I now mix and match nominal and structural types in my projects, using them where they best fit.

Re: Typing Is Hard

#132

Earlier quoted context omitted.

This is... a joke, right?

If a surgeon needed the help of a computer to make sure that he/she didn't confuse your heart for your kidney, would you trust that surgeon to do an operation on you?

I wouldn't ever trust you to make an analogy

Re: Typing Is Hard

#133

Earlier quoted context omitted.

That's correct, but seems irrelevant?

It's very relevant. In fact I would argue that type systems only address the simplest possible errors and do absolutely nothing about the most complex, time-consuming errors such as those related to unpredictable state mutations caused by multiple events being processed in parallel or having different parts of the code operate on the same instances. In fact, I would argue that static typing encourages developers to d…

statically typed languages with dependent types solve this problem of “static types not catching off-by-ones”, although I question the premise of these being the most common software bugs. Perhaps in a CS class these are the most prevalent?

Furthermore,

> Dynamic languages encourage more modular, more interchangeable code.

Have you ever used an ML or another typed language with an actual module system? It makes these dynamic languages look duct-taped in comparison.

Re: Typing Is Hard

#134
post #124

Earlier quoted context omitted.

Yep, correct! Thanks :-) Btw i love "out-floop" and I'm going to try to find applications for it.

Perhaps via reference to https://en.wikipedia.org/wiki/BlooP_and_FlooP ? EDIT: though, in that context, I would parse "out-floop" as a transitive verb meaning "to FlooP more, to a greater extent, or faster, than ", rendering its opposite actually "under-floop".

"He out-flooped the infloop with bloop" (which would be pretty impressive)
Post reply on HN