3 ms·
I've used perl5 for a long time (although these days I've replaced it with python in my toolchain, although I have my fair share of complaints about python as w
by simias 8y ago
I've used perl5 for a long time (although these days I've replaced it with python in my toolchain, although I have my fair share of complaints about python as well) and I think your comparison is unfair.
Rust's sometimes complicated syntax is made necessary by the very concept of the language. You need to be able to express lifetimes, you need to be able to express generics, you need to be able to strongly type lambdas etc... Of course the syntax is going to be a bit more complicated than, say, Common Lisp where everything is dynamic and garbage collected and you can let the runtime figure things out.
Perl 5 was syntactically insane because that's how the authors decided to do it. Effectively it didn't let you express things that were impossible in Lisp, Python, Ruby or JS. It's just a design choice to lean heavily on sigils and magic variables to favor short code even if it can be cryptic to people not intimately familiar with the language. I doubt anybody who hasn't used perl before will be able to figure out exactly what this does (and I'd argue that it's a fairly simple and idiomatic script, not some heinously cryptic code golf):
while (<>) { chomp(); s/f.o/bar/; print; }
Rust is noisy because it has to represent concepts that simply don't exist in other programming languages.
I'd go even further: Rust does a better job than most languages at letting you only explicitly mention things that need to be explicitly mentioned. Thanks to the very powerful type inference you can write very tidy code, IMO much more so than in C where I have to explicitly type every intermediary variable that I would use for instance.
- ajross 8y ago> Rust is noisy because it has to represent concepts that simply don't exist in other programming languages. In a few cases having to do with lifetime management and the borrow checker, that's certainly true. But the example at hand is fundamentally just cloning ideas from Javascript.
- majewsky 8y agoThe point is not that particular feature. It's how this new feature interacts with a bunch of existing language features.
- dbrgn 8y agoActually JS just cloned those ideas from C# and Python.
- steveklabnik 8y ago... and when you get down into the details, there are significant differences in what Rust is doing as opposed to these languages, even if the high level idea is roughly the same.