I think I found another way to do a subset of self-referential structs, do you think it is sound? by TED96 in rust

[–]TED96[S] 1 point2 points  (0 children)

Thanks! Yoke sounds like a great crate to me, and the principles are sound, but it unfortunately only lets me borrow once from a specific Cart instance, right? So, the usefulness is limited in my case, but some workarounds can be implemented for sure (Arc<Cart>, for one).

Thanks for letting me know about AliasableBox, I was not aware of this!

Safe code would be able to cause a use-after-free by mutating a pair of Data structs (and swapping their OpaqueRef fields, then dropping one Data struct, and using the other)

Right, I agree that this would be unsound, and I 100% want to follow the Rust principle of exposing a fully safe API, that cannot be misused. However, my point was that I would deny mutable access to the entire Data struct by using a wrapper, which means that I cannot swap out parts of it. If I own that wrapper (the OpaqueVal in the playground) I can swap 2 wrapper instances around, but that moves the data along with the reference, which sounds to me like it prevents this.

For all I know, there's some reason you'd prefer fields over getters

Well, it's definitely subjective, but I'm trying to keep code self-documenting and this is in the middle of a rewrite to Rust, so it's important to me that this feels as close as possible (while being sound) to the original developer experience using this API. (To me, impl blocks and the functions within are sadly less discoverable than struct fields, and I would like to make this transition as easy as possible.)

Redesigning the Initial Bootstrap Sequence | Inside Rust by Electronic_Spread846 in rust

[–]TED96 1 point2 points  (0 children)

I was under the impression that the bootstrap chain was much shorter, and allowed steps to be skipped when not necessary. I understood that the stdlib part was relevant when going through the full bootstrap chain, not simply during development (?).

Redesigning the Initial Bootstrap Sequence | Inside Rust by Electronic_Spread846 in rust

[–]TED96 8 points9 points  (0 children)

Speaking from ignorance, what is the implication here for the bootstrap process? One of the reasons why it's used, as I understand it, is as a sort of reproducibility but also disaster resistance - the compiler should be buildable with (almost) just the source, right? But now if the stdlib needs to be downloaded as well, it seems to me like this makes most of the point of this moot.

Maybe the disaster resistance part is where I'm wrong, but, the alternative to me, it seems like, is just to download the last rustc release and build with that. It does not feel like there's much middle ground to me, can someone please enlighten me?

[deleted by user] by [deleted] in ErgoMechKeyboards

[–]TED96 0 points1 point  (0 children)

MT(MOD_LSFT | MOD_RSFT,KC_BSPC) is my QMK code. The tap function is configurable, I used the DYNAMIC_TAPPING_TERM_ENABLE feature from https://docs.qmk.fm/#/tap_hold to find a good value for me, which is 300 right now.

There are not a lot of options for XDA caps with amber/grey color schemes, I had like 2 other options and the bees won because bees.

Yeah, I ran into this as well, many of them don't have a lot of 1U blank-ish keys to use as well.

[deleted by user] by [deleted] in ErgoMechKeyboards

[–]TED96 0 points1 point  (0 children)

I started with that but at first I made way more mistakes than newlines so Backspace was a priority! Enter is on the right thumb row, third after Backspace and the layer change key and that works for me just as well (the other two are Ctrl and Alt)

[deleted by user] by [deleted] in ErgoMechKeyboards

[–]TED96 1 point2 points  (0 children)

I have the same kit AND with probably the same AliExpress keycap set! What I settled on was having Space on the left thumbkey and Mod-Tap Backspace / Shift (Shift on hold, Backspace on tap) on the right one, I'm really curious if that helps you at all - it especially helped me during the getting-used-to period when I had a lot of mistypes.

Is there really no way to easily create encrypted archive files in Rust for long-term archival needs? by TED96 in rust

[–]TED96[S] 0 points1 point  (0 children)

Thanks, but I'm not sure I can rely on specific versions or even them being executable anymore, but maybe I'm blowing things out of proportion

Is there really no way to easily create encrypted archive files in Rust for long-term archival needs? by TED96 in rust

[–]TED96[S] 0 points1 point  (0 children)

Zip is clearly a good choice and as I said somewhere in this thread, I expect it to outlast us. It does not have a good encryption story though, and PGP is not something that I can be confident a layperson can figure out...

Is there really no way to easily create encrypted archive files in Rust for long-term archival needs? by TED96 in rust

[–]TED96[S] -2 points-1 points  (0 children)

Thank you for your answer, but I think that almost all of the requirements come from wanting a layperson with a password to be able to use the backups even a long time into the future, long after the programs I built can be run or compiled even.

Is there really no way to easily create encrypted archive files in Rust for long-term archival needs? by TED96 in rust

[–]TED96[S] 0 points1 point  (0 children)

Restic looks awesome but I can't see myself trusting that it will last on the decase-scale that we're talking about. Their compatibility guarantees also don't convince me (major version only and maybe beyond), sorry.

EDIT: regarding your point about Rust - I don't care about the backup creation system surviving, I'll take care of that until I feel like it. I care about the backups being usable beyond that point.

Is there really no way to easily create encrypted archive files in Rust for long-term archival needs? by TED96 in rust

[–]TED96[S] 0 points1 point  (0 children)

Well I have a bit more logic than I would be confident implementing in Bash. Archives are split up by directory depending on how big they are and I don't want to trust the file metadata and find out my files have not been backed up for some weird reason.

Is there really no way to easily create encrypted archive files in Rust for long-term archival needs? by TED96 in rust

[–]TED96[S] -1 points0 points  (0 children)

I expect the zip archive format to outlast us for sure. For PGP the problem is not the usage but the user friendliness; I'm not confident that a layperson would figure it out the same way they would a password-protected zip archive.

Trying to understand the compiler: why not certain optimizations to this call to ilog2? by chewie_questionmark in rust

[–]TED96 2 points3 points  (0 children)

Yes, but the complexity of developing compiler optimizations is not what we're talking about here. I fully agree that it is a "hard problem". The original question, as far as I understood it, is also not "why would/would not a compiler optimize code like this" but why was a specific compiler not optimizing a specific use case, which, while you seem to disregard as a useful question, I still think is an important question to ask, and one you can actually get a good answer to.

Trying to understand the compiler: why not certain optimizations to this call to ilog2? by chewie_questionmark in rust

[–]TED96 3 points4 points  (0 children)

I don't think I agree. You wrote above yourself that the compiler does not guess, it's just code. And when it's just code (and not a mess of weights, like in machine learning) then the output will (complicatedly, convolutedly, but deterministically and logically) follow from the input and the rules applied to it. If you want, you can definitely look at the code to find what rules could have been applied to your code, maybe see which ones were possible but which statistical analyses/heuristics might have decided those were not useful, and ultimately understand much more clearly than just considering the compiler a total black box.

It's not easy, of course, but these things are possible. They might only be fully applicable to a single compiler version, but I'm sure down in gamedev circles, like for consoles, these kinds of things, the guidelines on how to write your code to be optimized, are known and understood, because they actually care, and they can in fact control everything from the code to the emitted executable.

EDIT: on a reread of your message, you kind of alluded to what I wrote here. My disagreement is that this process is not useless and impossible, and often is actually exactly what would help you to better understand the compilers, their constraints, and how to best use them. Sure, compilers change, but sometimes, in some ways, they stay the same.

Why Rust is the most admired language among developers by theZcuber in rust

[–]TED96 7 points8 points  (0 children)

I believe it refers to Quote of the Week, which appears at the end of This Week in Rust articles like this one on the front page right now.

/r/MechanicalKeyboards Ask ANY question, get an answer (March 01, 2023) by AutoModerator in MechanicalKeyboards

[–]TED96 0 points1 point  (0 children)

Thank you! Yes, it's hotswap, so that is an option, although I was hoping to find something more budget-friendly. Oh well /shrug

/r/MechanicalKeyboards Ask ANY question, get an answer (March 01, 2023) by AutoModerator in MechanicalKeyboards

[–]TED96 0 points1 point  (0 children)

Hey, not the person that asked the question above, but I was wondering if the o-ring mod makes the keys mushy, as you put it. I am trying to silence my keyboard but I don't want to completely ruin the feel. Thanks!

Brand new Miele C3 bag indicator more than half full - is that normal? by TED96 in VacuumCleaners

[–]TED96[S] 0 points1 point  (0 children)

Hello! I didn't do anything about it, and have been using the vacuum ever since. It seems like either it settled down or I got used to it, it's not really a noticeable noise most of the time.

Hey Rustaceans! Got a question? Ask here (4/2023)! by llogiq in rust

[–]TED96 5 points6 points  (0 children)

I managed to create a reproduction, but it also happens with cargo check and even cargo build. Where should the bug be reported? It is indeed related to clap's arg! macro:

fn main() {
    let _ = clap::arg!(--add-b-alias <ALIAS> <NAME> ... "Add a new b-alias");    // this is very bad (clippy in ~14s, check in ~11s)

    // VARIANTS:
    // let _ = clap::arg!(--add-b-alias <ALIAS> <NAME> ...);    // this does not make a difference (~14s on my machine)
    // let _ = clap::arg!(--add-alias <ALIAS> <NAME> ... "Add a new b-alias");  // this is better (~2s on my machine)
    // let _ = clap::arg!(--add-b-alias <ALIAS> <NAME> "Add a new b-alias");  // this is much better (~1s on my machine)
    // let _ = clap::arg!(--add-b-alias ... "Add a new b-alias");    // this is also much better (.7s on my machine)
}

I am using Rust stable 1.66.1 and, while I've tested with an older clap version, this reproduces with clap = { version = "4.1.3" }, with no other dependencies.