Michał "phoe" Herda is a user on functional.cafe. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.

Am I the only one who feels like dynamically typed #programming languages are becoming obsolete? Type systems are more expressive and type inference is more ergonomic, so there seems to be few arguments in favor of weaker typing.

Michał "phoe" Herda @phoe

@icefox Common Lisp user here.

There's been a lot of improvement in the Common Lisp world regarding typing, especially regarding compile-time type inference. You can write bits of Lisp code with all types declared up front, and therefore get statically typed code that 1) performs better because of fewer runtime type checks, 2) is safer because type mismatches are signaled at compile time.

This solution doesn't prevent you from dynatyping whenever you need it to or enjoying other Lisp boons.

· Web · 0 · 2
@phoe @icefox
Although I second what @phoe said, in my opinion the original statement has not been given enough thought.

First of all, what does it even mean that type systems are more expressive? More expressive than what? For what kind of project and team? For a person that likes them, they *might* be better, but only because that person likes them and has some experience with them. There's no silver bullet, no one-size-fits-all.

You say weakly-typed languages are "obsolete"? We've got Mastodon (written in Ruby) and Pleroma (written in Elixir) live and kicking.

It would make much more sense to write "I prefer static typing", because people tend to stick to what they already know and like - that's how our brains work.

@pfm @phoe

More expressive than earlier static type systems. Consider C or Pascal's type system, then consider C#/Java, then consider Rust's, then consider Haskell's. The amount of metaprogramming and reasoning about types and their properties gets increasingly more sophisticated, so the guarantees you can make also gets more and more comprehensive. Now you have sum types, product types, dynamic dispatch, generics, higher-kinded data types, and so on. C has `void *` and that's all you get.

@pfm @phoe And I said "becoming obsolete". :-P This doesn't mean they're going away, it means they're starting to look a lot more like statically-typed language. Gradual typing is part of Julia and is now infecting Python for example, and probably Javascript soon (dunno about Ruby)

So my prediction, based off of current data, is in 10-20 years purely dynamically typed languages will be considered as old-fashioned and ill-principled as a large software project without tests is considered now.

@phoe Yeah, I'm aware of that. The Python people at least call it "gradual typing" and it's really nice, but CL naturally had it like 30 years before anyone else.

My main priority is the safety rather than the performance, to be honest