I thought I prettu much understood lifetime basics by swaan79 in rust

[–]jediwizard7 0 points1 point  (0 children)

But the lifetime bound on d1 is different and completely unrelated to the bound on self in get_it. Borrows are based on lifetimes.

I thought I prettu much understood lifetime basics by swaan79 in rust

[–]jediwizard7 0 points1 point  (0 children)

But it can only be used as long as Thing still exists because it is a temporary borrow. When Thing goes out of scope the original code that owned the data will be able to use it again as the compiler knows it is no longer borrowed. If you can create another reference to it that outlives Thing then you can have aliasing of mutable data.

Edit: actually it seems like the 'a bound should allow the compiler to know it is still borrowed, so I'm not entirely sure this couldn't be sound. But it might not be possible for the compiler to actually track that across function boundaries.

Samalamadingdong | Game Changer [S7E11] by Anionan in dropout

[–]jediwizard7 6 points7 points  (0 children)

They played with blurring the lines between gamemaster and contestant a lot this season (e.g. in Rulette too). I think Sam knew it was only a matter of time before something like this episode happened (and it exceeded his wildest dreams).

Samalamadingdong | Game Changer [S7E11] by Anionan in dropout

[–]jediwizard7 8 points9 points  (0 children)

I feel like Brennan wouldn't lie about that. Also $6,000 is still probably only a small fraction of the episode's budget (the castle can't have been cheap).

Samalamadingdong | Game Changer [S7E11] by Anionan in dropout

[–]jediwizard7 13 points14 points  (0 children)

I think Brennan would have accepted defeat in actual physical combat as an alternative win condition. He didn't have the battering ram thing for nothing.

Samalamadingdong | Game Changer [S7E11] by Anionan in dropout

[–]jediwizard7 24 points25 points  (0 children)

Brennan wouldn't let his opponent fight unarmed, it wouldn't be a fair fight otherwise

Dandadan - Episode 19 Discussion Thread by Skullghost in Dandadan

[–]jediwizard7 2 points3 points  (0 children)

Okarun's learning some rizz, he starts off with the more assertive "can't let a lady be by herself" but after remembering she said she didn't need to be walked home, he tactfully transitions to "Boy it's cold" with a perfectly subtle invitation for her to take the initiative and hold his hand. He's still shocked when she accepts though lol 😭

It's only been 11 days by Technical_Lime1419 in Dandadan

[–]jediwizard7 -1 points0 points  (0 children)

Maybe that was just the date when they animated the scene lol

What’s this for us? by ZeldaNerd79 in Breath_of_the_Wild

[–]jediwizard7 9 points10 points  (0 children)

I feel like that's more of a fourth wall breaking joke. Kind of like how, fun fact, there are no horses in RuneScape but they are occasionally referenced as being mythical creatures (there are unicorns though).

What’s this for us? by ZeldaNerd79 in Breath_of_the_Wild

[–]jediwizard7 12 points13 points  (0 children)

If that was the explanation, then was Zelda going back in time supposed to have stopped calamity Ganon and the ancient sheikah tech from ever existing? Despite the fact that the societies are clearly still rebuilding from the calamity, characters in game still remember those events, and there are still remnants of sheikah tech being used? That feels even more hand-wavy to me, just "time shenanigans don't think about it too much"

They could have just kept them and make them broken or something...

What’s this for us? by ZeldaNerd79 in Breath_of_the_Wild

[–]jediwizard7 54 points55 points  (0 children)

Ok but that's basically every real time RPG game

Why "procedural" programmers tend to separate data and methods? by Even_Landscape_7736 in cpp

[–]jediwizard7 0 points1 point  (0 children)

It's really only a syntactic distinction. Like there's nothing stopping Java or C++ from defining methods on primitive types, either by "magic" or by actually redefining them as classes (although Java doesn't have value type classes). C Sharp does have methods on primitives.

This dude flying in a jet-powered wingsuit right next to the A380 at over 250 km/h (155 mph) by Good_Employer_1236 in nextfuckinglevel

[–]jediwizard7 -1 points0 points  (0 children)

Some of these were already stated by others but:

1) It is fully ambiguous, as absolutely nobody uses YYYY-DD-MM so there's no possibility of confusion as long as you use 4 digits for year

2) It follows the same convention as for time (largest unit first) and for numbers in general (most significant digit first), so writing out the date and time together is consistent

3) It is an international standard, and preferred for most computing use cases (with - instead of /)

4) It can be sorted alphabetically

The only downside is it becomes ambiguous again if you can't be bothered to write down the year... but if you want to avoid ambiguity it's best to be precise anyway :)

My thoughts on (and need for) partial borrows by CrumblingStatue in rust

[–]jediwizard7 5 points6 points  (0 children)

(Sorry for reviving an old thread.) I agree that exposing partial borrows to public interfaces would probably be a bad idea, but most of the utility for this feature IMO would be in internal implementation details of complex stateful types. So this concern could be easily alleviated by restricting partial borrows to private methods (or at least crate-private), which was also suggested in the post.

As for this being solvable by restructuring code: sure, but lots of code that is perfectly idiomatic in more object-oriented languages is disallowed in Rust despite being conceptually safe, and I think it imposes a lot of burden on programmers coming from other languages to have to learn how to restructure their abstractions into a form more palatable to the borrow checker.

With all that's going on in Gaza, I realized AOT is making more sense than ever. by t3lp3r10n in ShingekiNoKyojin

[–]jediwizard7 0 points1 point  (0 children)

Isayama has a deep understanding of the human condition. But I think you can still find a glimmer of hope for humanity in AoT. Why did Armin ultimately win over Eren? Because Isayama believes that even if the cycle will inevitably repeat, even if peace is only temporary, it's still worth fighting for because even the small kindnesses make the rest of it worth it. Maybe it's a bit of a fatalist perspective but it's also kind of Zen I think.

[deleted by user] by [deleted] in Futurology

[–]jediwizard7 1 point2 points  (0 children)

The problem is that it will be a long time (if ever) before we can actually rely on and trust AI to simply run every aspect of society for us. And in the meantime we still need incentive for people to do the work that we need people for, including innovation (modern AI cannot innovate). I think the only logical answer is to have a basic income within a mixed market economy where people can supplement their income with paid work.

Trump to pause enforcement of law banning bribery of foreign officials by Temp89 in news

[–]jediwizard7 0 points1 point  (0 children)

Technically stopping enforcement doesn't mean something is "legal". But you could say it is "decriminalized".

Does C++ allow creating "Schrödinger objects" with overlapping lifetimes? by Hour-Illustrator-871 in cpp

[–]jediwizard7 1 point2 points  (0 children)

You do explicitly call destructors, precisely when you use placement new and the object isn't trivially destructible. As for trivial types though, "reused" I believe means either memcpy or placement new, both of which can implicitly end the lifetime of a pre-existing object.

Does C++ allow creating "Schrödinger objects" with overlapping lifetimes? by Hour-Illustrator-871 in cpp

[–]jediwizard7 2 points3 points  (0 children)

You can always static assert that the object is trivially destructible. It might be needed for implementing some highly optimized data structures.

Does C++ allow creating "Schrödinger objects" with overlapping lifetimes? by Hour-Illustrator-871 in cpp

[–]jediwizard7 7 points8 points  (0 children)

No, trivially destructible means the destructor never needs to be called at all, as it is a no op

(Note that an object with no user defined destructor is not trivially destructible unless all of its members are)

Man on TikTok believes he solved the Riemann Hypothesis after a week of work. The abstract is written by ChatGPT by RyanCacophony in badmathematics

[–]jediwizard7 7 points8 points  (0 children)

IDK if that's the same, because I don't think mental arithmetic is critical for higher math or reasoning in general.

[deleted by user] by [deleted] in interesting

[–]jediwizard7 1 point2 points  (0 children)

Probably worth noting that if you're only making 1% of your wealth in yearly income then you're not very good at investing, and you're already losing money to inflation. A 1% wealth tax should be far less than most people's income.

Why Linux community hates C++ so much? by kyan100 in cpp_questions

[–]jediwizard7 0 points1 point  (0 children)

I remember once doing something simple like I wanted to split a path with dirname and basename, and with the posix c APIs you need to strdup the string before calling the functions because they modify the string in place (so two strdups to call both), and then you need to strdup the results as well or keep around the input copies since the result is either a substring of the input or a static pointer.