this post was submitted on 16 Oct 2024
67 points (98.6% liked)

Rust

5999 readers
19 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
 

If we were to create a Rust version of this page for Haskell, what cool programming techniques would you add to it?

you are viewing a single comment's thread
view the rest of the comments
[–] snaggen@programming.dev 10 points 1 month ago* (last edited 1 month ago) (11 children)

Mindblowing features are basically, by definition, a result of bad language design. They blow your mind, since they are totally unexpected behaviours. They may still be cool, but they are unexpected and hence unintuitive.

A language that are full of these is Perl. And one simple one is that you can take the string "AAAAA" and use addition on that, like "AAAAA"++ and you will get the result "AAAAB". Cool you may think, but is it really? Addition is normally used to increase the value of a number, that is a completely different operation than modifying a String. The string "AAAAA" cannot be said to be greater or less than "AAAAB", besides the very special case when we order it. But in general the name "John" is not considered to be higher/lower than "Mark", they are just different. So, even if it is cool to manipulate strings by using addition/subtraction, it is still bad language design and very unintuitive. Also, since perl is so loosely typed, it may also cause very unexpected bugs.

[–] barsoap@lemm.ee 6 points 1 month ago (1 children)

The string “AAAAA” cannot be said to be greater or less than “AAAAB”, besides the very special case when we order it.

I hate it to break it to you but it's the same with numbers.

[–] snaggen@programming.dev 1 points 1 month ago

Ok, I then have some business proposals....

load more comments (9 replies)