News for hackers. Stuff that matters.
Re:Strong typing, a hill I'm willing to die on by tipiirai on Wednesday October 04, 2023 @11:55PM (#37774760)
Someone here commented that it takes 2.39s for tsc to check types for `console.log('Hello, world!')` [1] (esbuild does not check types).

[1]: https://news.ycombinator.com/item?id=37765713

Re:Strong typing, a hill I'm willing to die on by richbell on Thursday October 05, 2023 @02:51AM (#37775592)
That seems like more of a tooling issue than a reflection of static vs dynamic typing.
Re:Strong typing, a hill I'm willing to die on by sensanaty on Thursday October 05, 2023 @05:10AM (#37776414)
Why do people keep using hello world as good examples of anything?

I'm not a TS zealot at all, but my work project which is around 2000 TS/Vue files (some of them hundreds of lines long and even breaking into the thousands for a lot of them) manages to get checked in around 3 seconds if there's a cache, and no-cache runs take 10s or so (which also involves actually transpiling the files)

Re:Strong typing, a hill I'm willing to die on by tipiirai on Thursday October 05, 2023 @05:35AM (#37776573)
The parent was looking for evidence for why someone could write tests easier with dynamic languages. A long waiting time for type checking to finish came to my mind first. I think hello world is a valid example when talking about unit tests.
Re:Strong typing, a hill I'm willing to die on by the_af on Thursday October 05, 2023 @09:59AM (#37778716)
I don't think Hello World is a good example for anything; all you can do with it is microbenchmark, which is not particularly interesting. There are also no meaningful unit tests to write with Hello World.

With tiny examples, compile/tooling times tend to dominate.

More interesting would be a larger, non-toy prototype, where the tests and prototyping effort are meaningful.

Re:Strong typing, a hill I'm willing to die on by the_af on Thursday October 05, 2023 @09:52AM (#37778618)
This is more of a reflection on tsc, but also, Hello World is not a good example because it's not a real world prototype.

For conclusions about rapid prototyping you'd need to do this experiment:

- Prototype something real, not a tiny toy example like "Hello, world".

- Go end to end with your experiment, so instead of focusing on how long it takes to run the typechecker (which makes no sense, since dynamic languages don't have this step), measure how long it takes you to iterate your prototype from start to a finish (including everything: failed attempts, code does not do what you want, writing tests, troubleshooting stuff, and the final working demo).

Again, I must ask: where is the evidence that dynamic languages are faster for prototyping?

This paper by Paul Hudak, "An Experiment in Software Prototyping Productivity" [1] has multiple flaws you could argue, but what's amazing is that Haskell beat all other languages in the list (none under discussion here, sadly -- that's one of the flaws) for fast prototyping!

--

[1] https://www.cs.yale.edu/publications/techreports/tr1049.pdf