top | item 36588670

(no title)

llogiq | 2 years ago

Yeah, that one hasn't aged too well. We've all seen the backswing to statically typed languages. Yes, some of them (e.g. typescript) run on top of dynamic langs, or allow for VMs (hi, WASM!). Why? Because ironically the same famed flexibility that makes it oh so easy to whip up a prototype is biting us in the ass when it comes to make a production-grade piece of software while staying on top of the ever changing requirements. So while we have a lot of python in ML (where most things haven't left prototyping stage), a lot of code nowadays is written in languages like Rust, TypeScript, Swift and others.

Not (only) because that's faster to run, but because it's faster to change while still remaining somewhat working correctly. And the current crop of compilers not only can produce stunningly fast code, but also awe-inspiringly great error messages that put the 90's and oughties' cryptic error messages to shame. Try that with a dynamic language!

discuss

order

jmull|2 years ago

IMO, it hardly seems useful to consider a dynamic language with statically checkable type annotations to be a static language.

I think it’s interesting how static and dynamic languages have grown closer together since this was done. I’m not sure there’s really all that much to argue about anymore. Your static languages tend to have many of the features people like about dynamic languages and vice-versa, though of course that depends on the specific language.

frou_dh|2 years ago

The situation with CPython where you can type-annotate and statically type-check your code to the hilt and that confers no runtime performance benefit is so tragic.

llogiq|2 years ago

Well, if the programmer writes the type annotation to actually have their code checked, how would a gradually typed language differ in practice from a static language?

Yes, you can still do dynamic typing. But I'd argue that using `dyn Any` you can do so in Rust, which is a statically typed language if I ever saw one.

Otherwise I completely agree about the languages growing closer together.

lelanthran|2 years ago

Optional typing is closer to dynamically typed than to statically typed.

krupan|2 years ago

What are you even talking about? The amount of JavaScript and Python in the world has probably grown exponentially since that article was written. The article points out that there are ways to make dynamic languages faster and JavaScript interpreters have indeed been made blazingly fast since this article.

Sure a handful of people use Rust now and Swift and Go now, but I think you missed the whole point of the fine article

MrJohz|2 years ago

Except both Javascript and Python - along with a bunch of other dynamic languages such as Ruby and Elixir - are adopting gradual typing into the ecosystem. In both Javascript and Python, most of the major libraries and frameworks are either typed directly, or provide typings. It's difficult to get a good overview of the ecosystem on the closed source side of things, but most of the people I talk to in the Javascript world are moving pretty quickly towards Typescript, or have done it already.

But the key thing is that none of this is for performance purposes. Which is kind of the whole point of this talk: speed isn't everything, and the productivity of languages without types outweighs that of languages with types. But it turns out that types are really useful even without any sort of performance benefit, hence why a lot of languages are turning back to typing code without using those types at runtime at all.

Or similarly, he makes a point about how it's often possible to statically analyse dynamic languages, which is true, but it turns out that it's still so much easier to analyse statically typed languages that adding types back in often makes sense. If you read library documentation for packages using gradual typing, this is often one of the things they specifically mention as a reason for using their library with static types instead of without.

The point, as I understood it, was that you don't need static types to still get lots of cool things (performance, analysis, etc). Which is stuff I don't disagree with. But the quality of those things with (well-designed) static languages is still so much higher than it is in dynamic languages, which is why so many languages are now trying to support both modes.

behnamoh|2 years ago

> So while we have a lot of python in ML (where most things haven't left prototyping stage)...

That's a really good observation. Many people ask why Python is the lingua franca of ML. It's a glue language that allows you to prototype quickly and use low-level libraries like numpy for matrix calculations, etc.

I wish Python type hints were taken more seriously. It's crazy that you can type them in function definitions but then Python completely ignores them. mypy does a much better job at that, but that's not the Python most people use.

ActorNightly|2 years ago

> It's a glue language

Its a lot more than a glue language. Its just the right amount of high level abstraction with easy extensibility to make it applicable to most applications out there.

Even for things that are performance sensitive, extra containers/instances are cheaper than developers.

troupo|2 years ago

> We've all seen the backswing to statically typed languages.

We're seeing a swing to what I call "pragmatically typed" languages: those with extensive type inference and possible escape hatches.

novok|2 years ago

IMO I miss static typing at around the 500 line mark especially when making programs. I was surprised it was that fast.

spankalee|2 years ago

TypeScript is not a statically typed language. It's more like a type-aware linter for a dynamic language. It doesn't "run on" JavaScript, it more-or-less is JavaScript. Any runtime helpers that TypeScript includes are merely polyfills for JavaScript features and compiling to the esnext target includes no runtime code at all.

TypeScript isn't faster than JavaScript, it doesn't even change it's emit based on types - which are completely erased.

Similarly, Python with type annotations is not a statically typed language either.

impulser_|2 years ago

> So while we have a lot of python in ML (where most things haven't left prototyping stage)

A lot of ML startup use Python in production. OpenAI uses Flask to power their API for ChatGPT and their other models. Almost every AI startup uses Python in production for more than their ML/AI stack.

Python, Javascript, PHP, and Ruby are still very popular languages today. More popular than Typescript, Rust, Swift and pretty much every typed language outside Java, Go, C and C++.

Tainnor|2 years ago

> We've all seen the backswing to statically typed languages.

I think, in general, we've seen the hype cycle shift from static to dynamic to static, and we see that e.g. startups and otherwise highly opinionated people who care about such things maybe change their preferences (or simply new people entering the field with new preferences), but...

the millions of people writing Java code didn't go away when Ruby and later Node were all the rage, and all the PHP jobs also still exist.

Trends come and go, but dynamic and static typing have coexisted since forever. LISP is the second oldest language and if that's too niche, Smalltalk was decently popular for a while.

I also agree though that modern statically typed languages are much better than e.g. Java used to be.

LispSporks22|2 years ago

> current crop of compilers not only can produce stunningly fast code

There are highly dynamic languages like Lisp that have implementations that have generated “stunningly fast code” for ages.

marcelr|2 years ago

Give it another 10 years, it'll swing back.

Dynamic languages increase productivity, static languages learn from dynamic languages & find ways to statically verify the previously thought dynamic patterns.