snaggen

joined 2 years ago
[–] snaggen@programming.dev 2 points 2 years ago

a crate may contain may different parts, and you may not always want all of them to avoid bloat. For an example, a crate may contain a sync and an async version, but you will probably only want one of them. So then the crate exposes the different parts as features. In clap they have defined the default features as:

default = ["std", "color", "help", "usage", "error-context", "suggestions"]

So, then if you need to use functionality not included there, then you have to specify it in your features list. On https://docs.rs/crate/clap/latest you can find a drop down in the top menu with Feature Flags, then they also have the documentation for the feature flags here https://docs.rs/clap/latest/clap/_features/index.html

[–] snaggen@programming.dev 1 points 2 years ago

It should be, in the ideal world, just be thrown as a last resort... but in reality it isn't. I assume it is because when you find a nice IllegalStateException, you might feel that it really describes your condition quite well, so you use that without realizing that it is a surprise exception since that is not very clear. When you are using your IDE and need to throw an exception in an error case, it is not clear what is a runtime exception and not, and then you are not forced to use throws and here we are...

The equivalent in Rust would be to have a std::error::GenericError(String) in rust, that looks like a normal error but secretly panics under the hood.

[–] snaggen@programming.dev 1 points 2 years ago* (last edited 2 years ago) (2 children)

try

clap = { version = "4.3", features = ["derive"] }
[–] snaggen@programming.dev 1 points 2 years ago (2 children)

Well, but then any function may also throw random runtime exceptions, so even if a function declares that it throws IOException, it may also deep down throw an IllegalStateException. And if you then were naive enough to only catch IOException, then you are in trouble. I recently had that case, were I had forgot the top level catch (Throwable t) clause and the program just died with nothing in any log. Adding that top level catch and a log line, made me see where it threw and what. Then I just needed to add additional logging around that to see the application state to understand the why.

[–] snaggen@programming.dev 1 points 2 years ago

This is the reason you need to log the application state all of the time, to get context to the backtrace.

[–] snaggen@programming.dev 2 points 2 years ago (2 children)

Yes, Java lives by the credo "Backtrace or it didn't happen!"

[–] snaggen@programming.dev 1 points 2 years ago

I think you are getting things backwards.... Learning to write rust might be hard, if you are not used to typed languages or languages with explicit memory management with stack/heap separation. However, writing rust is not hard. It might take slightly longer in the coding phase, since you are forced to do things correct, you need to handle errors and are not allowed to share data between threads in dangerous ways aso. But that makes the resulting software a lot better, which means that the testing and support is a lot less. So, if anything, the net result of writing software in rust is that it is easier, since you are not allowed to shoot your self in the foot over and over again.

And remember, that every time rust is making your life difficult, you might have introduced a subtle bug in another language.

[–] snaggen@programming.dev 3 points 2 years ago

I have 2 categories, either Classical Music ( actually my preferred classical programming music is The Legend of Zelda: Concert 2018 by Tokyo Philharmonic Orchestra, and I'm not entirely sure it qualify as "Classical" ) or 80-style hard rock (Like the soundtrack for Peacemaker)

[–] snaggen@programming.dev 4 points 2 years ago (1 children)

And as someone pointed out in another forum, this was most likely a multi-choise question so it is impossible to know the true Linux percentage.

[–] snaggen@programming.dev 2 points 2 years ago

Yes, the plugin still have its limitations, but it is still my preferred full IDE (much because I'm so used to IntelliJ). But I find myself using NeoVim with rust-analyzer quite a bit also.... so I'm happy both exist :)

[–] snaggen@programming.dev 8 points 2 years ago (1 children)

For both of you, wouldn't it be nice to let me add my home instance so you could provide quick links to subscribe (and open the community in my home instance).

[–] snaggen@programming.dev 1 points 2 years ago

Unfortunately Turkey controls the Bosporus Strait which connects the Black Sea with the Mediterranean Sea (and the rest of the world). This makes the quite an important player since a large part of the Russian Navy is located in the Black Sea. Turkey is well aware of this of course, and know exactly how they can use this as a leverage against NATO.

view more: ‹ prev next ›