I don’t understand what the advantages of const expressions are.
Isn’t const { None }
the same as just None
?
I don’t understand what the advantages of const expressions are.
Isn’t const { None }
the same as just None
?
Both RefCell and unsafe are features of the language. That’s like saying python’s OOP sucks if you don’t use the class
keyword.
I don’t have the data, but I don’t think it’s wild to assume that most rust programs have 0-1 unsafe blocks, in total. Except for special cases like ffi.
Even if your rust project has 1000s of unsafe blocks, it is still safer than C++, which is 100% an unsafe block. You only have to carefully review the parts marked “unsafe”, in C++ you have to carefully review the whole code.
Also, because unsafe blocks are explicitly declared, you know which parts of the code require extra carefulness, and if you encounter a memory bug, doing Ctrl+F “unsafe” will soon show the root cause.
At least one drawback I can see is that apparently the user has to manually opt-out some macros (the ones that aren’t pure) of the caching. Which would require everyone using the rust compiler to know which macros of which crates are pure and which ones not. I guess that the ones writing the macros could do that, but then you rely on library maintainers to know about this specific optimization.
It really should be opt-in so the maintainers of libraries that know about the optimization and know that their macro is pure can annotate them as so.
No .unwrap()? It just panics?
I’m not saying that java or python are harder, of course they aren’t. I’m just saying that it’s not as hard as people seem to think. What is 1 week of commitment to learn a new language? Of course it depends on what there is to offer.
I think the benefits of rust far outweigh it’s drawbacks (including the learning time).
I highly recommend the vscode extension error lens
if you wanna change how errors/warnings are displayed.
That’s true. I might’ve gotten confused because I saw godot rust bindings.
If the compiler optimizes away some RC then I see how it can be faster.
A big difference between rust and C++ is that in C++ you say “everyone should passing by value or const ref (mutable ref if needed)”.
In rust, the default is passing by value. The default refs are consts, you have to explicitly make them mut, and the compiler will warn you if you don’t mutate a mut parameter.
Ref counting is just a very basic GC. I’d be surprised if a ref counted language performed better than a GC one. Sure, the program won’t temporarily halt in order to run the GC, but every copy/destroy operation will be slower.
I haven’t been able to compile a single C/C++ program (even bought a C++ book!) Learned to write normal programs in rust (even with simple lifetime annotations!) In 1-2 months. I just knew python and the basic knowledge of 1st year university.
It’s not that hard.
Just reading through the rust book (a week, maybe? I don’t remember how much time it took) will make you able to confidently write a simple CLI program.
Have you actually tried making a GUI or a game? I don’t think you can summarize the state of the whole ecosystem in a sentence that doesn’t change in years. I’ve made perfectly functional GUIs with iced, and imgui. Haven’t tried slint yet.
Godot is a very popular game engine and it’s written in rust, so you probably can use it in rust.
I misspelled. I meant the IDE support is great. I use VSCode, but what makes it good is Rust’s language server (rust-analyzer), which should work in any editor that understands the LSP protocol.
I don’t know if a proper IDE exists for rust, but I’ve never needed it.
I’m doing mostly hobby graphics stuff with wgpu
My latest project is a live visualizer of wgsl shaders.
I chose rust because it’s the only language that meets all these points:
Toggle buttons are not normal buttons, they are toggles. Which have the same functionality as check boxes. They are a toggle between 2 states. The only difference is visual.
If they toggle more than 2 states, (like a discrete slider), it is the same as a drop-down menu.
Some widgets are the exact same as others, where the only difference is their visual representation.
Never said nothing about a button. Toggles are just check boxes with a different aspect.
EDIT: the thread is actually about actual buttons. Maybe should’ve clicked on the link where it explains what he means by “toggle button”.
Toggles should not exist. They should be check boxes. Checked if “ON”, unchecked if “OFF” with a mouse over tooltip if there is any chance that it’s ambiguous.
I’ve never heard of slint before. I’ve only used iced and imgui. Can someone that has used it tell me its pros/cons?
Is the DSL good? Can I make UIs without the DSL? Does it have good multiline text editing? (Neither imgui nor iced is good at that).
Why do ISPs rotate IPv6 prefixes? Aren’t they basically infinite?
The main reason I want IPv6 is so I don’t have to use fancy DNS for dynamic addresses.