Rust is very comfy so far! Wrote what the Rust book suggests writing. If anyone knows Rust better than me please rate this code, it’s probably shit

@fugger See, I don't get why you call this comfy. Similar D code with similar performance and memory-safety would be so much comfier and so much easier to read

Follow

@fugger If stdin is closed such as from a ctrl-d read() returns 0 immediately so you get an empty string, otherwise you always have at least a \n

Idk how the rust code handles that

>not a fan of garbage collectors
I thought you liked Go, it's garbage collected. You can disable it in D but then you have to write things a bit more like rust

· · Web · 2 · 0 · 0
@applejack I don't plan to use Go for everything Go is simple so I plan to use it for simple projects as a result I will use

Rust if I am doing something like writing a game or backend and Go if I am doing something like idk a fediverse bot
@applejack that or I just use Rust all the time because I enjoy it a lot so fair I haven't played with Go much outside of just examination of the syntax and others code
@applejack I'll have to admit Rust is a bit heavy on how much you have to write out but it's easy to understand once you get the hang of it seems

@fugger The symbol soup is hard for me to type because Icelandic keyboards move all the programmer symbols to altgr combinations

I see you're learning Jap and Русскйи, you American?

@applejack
>I see you're learning Jap and Русскйи, you American?
Yes to all of that however postponed learning Russian pretty much to focus on other things but I plan to do it again soon
@applejack Also just like

>Variable shadowing
>Way it handles memory
>Immutable by default
>Expression and statements can be used in interesting ways hard to explain here
>Package manager
>128 bit number support natively probably will never use it just think it's neat combines two 64 bit numbers to my knowledge which basically has negligible proformance hit apparently :P
>Nice compiler errors will often just tell you how to fix the error
>Good ecosystem
>Unsafe code has to be put in unsafe block meaning it's much easier to find possible security vulnerabilities just by searching every instance of "unsafe {"

So fair only thing I hate is
>Have to type a shit ton not really issue in modern IDE
>Type inference
>Slow compile speeds
>Large binaries however can be mitigated quite easily with LTO among other things
@applejack oh yeah another neat thing about Rust is theirs a loop block that just loops forever

You can do this with while(1) but I think loop is more clear and easier to type
@applejack True is more readable arguably but I would hope every programmer would know 1 = True

@fugger I think variable shadowing is in basically everything

I dislike immutable by default because it's an extra keyword for the majority of variables while I've never had a bug ever occur from accidentally changing a variable that should have been const, plus, you'd probably define it mut out of habbit anyway. It feels like something mainly made for corporations with a billion people working on one codebase

You mean that every statement is an expression? Seems cool and useful but also a bit confusing. Seeing an if statement and not knowing whether it's "doing" or "returning" something

DUB package manager. It's pretty similar to cargo. dub add package, dub run

cent and ucent types

Generally with DMD too, bit less so with the clang and GCC versions

The ecosystem is the main thing that D really lacks. It's made by Walter Bright whereas rust is made by Mozilla and Go by google so it's hard to compete for attention

D lets you use @safe and they're introducing @live for borrow-checking

@applejack Also variables being immutable I think allows for greater optimization for the compiler so it's why I think it's a good idea generally also apparently can stop bugs I also haven't had this happen but whatever

@fugger It's mainly a bug and readability thing. Compilers can always check if you're changing the value or not

@fugger Yeah, I can respect that

For simple things like this I'd actually just use Lua. When I need very fast parallel processing I use C and OpenMP. When I need something simple but low-level it's D. When I need something async It's JS or Luvit

@applejack also the if statement not having brackets just looks strange to me it's understandable and not that bsd of course but it's just cursed to look at

@fugger There was a time I even added them to if statements in Lua. Now I'm pretty used to either. I still add them when I do rust though

Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.