Re: [LSF/MM TOPIC] Rust

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 23, 2024 at 10:58:09PM +0000, David Howells wrote:
> Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
> 
> > I really want this to happen.  It's taken 50 years, but we finally have
> > a programming language that can replace C for writing kernels.
> 
> I really don't want this to happen.  Whilst I have sympathy with the idea that
> C can be replaced with something better - Rust isn't it.  The syntax is awful.
> It's like they looked at perl and thought they could beat it at inventing
> weird and obfuscated bits of operator syntax.  Can't they replace the syntax
> with something a lot more C-like[*]?

I've heard you say this before, and I'm still curious what it is you
dislike about Rust syntax... because to my eyes, Rust syntax /is/
already quite C-like and the differences are all obvious fixes and
cleanups for things that have annoyed me for years.

Fixing the statement/expression distinction is really nice, so we no
longer have to use the ridiculous ({}) construct, and that also means
the ternary operator is no longer needed because if and match are now
normal expressions that can have values.

Changing how functions and variables are defined is also a nice fix -
the type of the variable or return value no longer being the first token
means Rust can be parsed in one pass; that's always been a painful part
of the C grammar.

Gegarding macros, C macros are pretty terrible in that they can
completely violate the syntax and know nothing about the syntax tree;
Rust macros operate on token trees and are much more regular (they're
also hygenic!).

Syntax wise, the only annoying thing for me has been getting used to
borrow checker syntax, but I'm more than willing to put up with that for
what it gets us...




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux