Hacker News new | past | comments | ask | show | jobs | submit login

There's nothing that makes typed languages inherently more verbose; a Haskell script will tend to be substantially shorter than the equivalent Python.

Rust gives you much more control over how your program runs, but this necessarily means paying a price in expressiveness.




I didn't say typed languages are inherently more verbose. I said that a type system tends to make things more verbose (in some cases), e.g. having to bang out types in function signatures, etc. When writing small scripts you usually just write down what you want to happen, and it works. There's some extra mental/typing overhead in a typed language in many cases. For larger programs, this overhead isn't important since you get many other benefits, but for small scripts sometimes it can be problematic.

It's not a hard-and-fast rule. It's something that I've experienced when trying to write small scripts in all kinds of typed languages. I keep going back to Python.

For larger scripty things I've found typed languages to work just as well.

> but this necessarily means paying a price in expressiveness.

I don't think this is true. You can have higher level abstractions in Rust too.


Not type systems per se.

But lack of garbage collection and the need for lifetime annotations for references and memory management with Box, Rc, Cell, Mutex, etc, combined with the type definitions makes Rust a lot more verbose than any dynamic language or even statically typed languages with GC like Scala / Go.

That can't be avoided, but you have to be prepared. Rust code can be short and elegant, but it can also be tediously verbose.


>a Haskell script will tend to be substantially shorter than the equivalent Python.

someone offered a counter-example where a JSON parser had more lines of type definitions in Haskell than total lines of code in Python


I wouldn't be surprised if the Python solution were shorter than Haskell version that doesn't use lens.

If you link me the example maybe I can provide a Haskell version using lens.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: