
DevotionGeo
What do you dislike about Rust?
For me it’s the semicolon, because I stopped using a semicolon in JavaScript, two other of my favorite languages, Elixir and Go don’t have a delimiter already. Before that I used Ruby (Rails) and that too didn’t have a delimiter.
So having a compulsory delimiter, semicolon in Rust bugs me a lot.
Most Liked

hauleth
The difference is that semicolons have meaning in Rust, in contrast to other languages you have mentioned:
fn foo() -> usize { 0 }
fn bar() -> usize { 0; }
Will have behave differently (in fact, one will not compile at all).
My issue with Rust is ?
operator which changes flow of the application. TBH I would prefer it to be “coalesce operator”, so instead of:
let foo: Foo = a()?.b()?.c()?;
It would work like:
let foo: Option<Foo> = a()?.b()?.c();

AstonJ
In the interest of balance, I’ve posted:

OvermindDL1
Remember this, the ‘semicolon’ is the sequence binary operator. Just like +
is. See a + b
will run a, then run b, then add them together and return the result, and a ; b
will run a, then run b, then it returns b’s result (throwing away a
’s). This is common in most languages that use semicolons as you need some way to ‘sequence’ operations. Elixir also has ;
but it makes newlines pretend to be a ;
when you aren’t in an expression body, which does introduce some syntax ambiguities in elixir (and javascript) that you end up hitting when you do enough coding in them.
So in Rust the ;
is not a delimiter, its the sequence operator, and you absolutely do not need it when you don’t have a need for sequenced operations, and without it you couldn’t know how to sequence operations otherwise (remember, in Rust any whitespace, whether a space, tab, or newline are all the same thing).
?
started out as the macro-by-example try!
, and just like the macro it still expands to the code inline. A ‘coalesce’ operator is just map
, as is the proper name of such a monad style container. (?
is most similar to ‘unwrap’ of a comand but instead of throwing it returns on failure).
The thing is that doing such a coalescing wouldn’t be a replacement for ?
at all as ?
actually removes the monad (Option
/Result
for example) and allows you to change the type trivially as the chain progresses. Of course you don’t need to use ?
either, it just expands to normal inline code and you can write that code (or even your own macro’s) as you wish.
Also, something like let foo: Option<Foo> = a()?.b()?.c();
is painful as you’d still have to unwrap the option/result and handle the failure case anyway, which is what ?
does, hence the above ?.
is not only not a replacement for ?
but it doesn’t even handle the same case, it’s something entirely different and would still leave the original issue of having to deal with the failing return manually.
For me though, what I’m disliking most about rust currently is the lack of GAT’s. Some other things I’d like but are currently ‘meh’ about in comparison to how overwhelmingly important GAT’s are to me are things like GADT’s or postfix macro’s or such things.
Popular Backend topics










Other popular topics









Latest in Backend
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /zig
- /scala
- /html
- /debian
- /nixos
- /lisp
- /agda
- /sublime-text
- /textmate
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /lua
- /nodejs
- /slackware
- /c
- /julia
- /neovim