Mama told me not to come.

She said, that ain’t the way to have fun.

  • 17 Posts
  • 8.98K Comments
Joined 2 years ago
cake
Cake day: June 11th, 2023

help-circle





  • a way to track them

    Yes, that’s what I’m suggesting. Injecting some kind of metadata that gets stripped at code gen time would probably work.

    worse incremental compilation performance

    Would it really be that significant?

    without allocating everything on the heap

    I’m talking about compile time.

    Start with all of the known safe cases (basic types should be fine), then move on to more dubious options (anything that supports iteration). Then allow iterable types but don’t allow iterating over a mutable reference. And so on. If it’s a priority to loosen up the rules without sacrificing safety, surely some solutions could be found to improve ergonomics.

    Or perhaps there could be some annotations to make a reference as “unsafe” or similar instead of just a block. If something is safe in practice but not verifiably safe, there should be a way to communicate that.

    You want some annotations to break out of the safe subset of the language

    The annotations would indicate that something unsafe is going on, so it’s like an unsafe block, but on a reference. That way it’s clear that it’s not being checked by the borrow checker, but the rest of the application can be checked.

    I really liked the idea of an optional, built-in GC w/ pre-1.0 Rust where specific references could be GC’d. If that were a thing in modern Rust (and the GC would only be enabled if there’s a GC’d reference included), we could get a lot more ergonomics around things like linked lists.




  • the orphan rule is not worse than what other languages allow

    Sure, but that doesn’t mean it can’t be better.

    Surely the compiler could delay optimizations until the entire project is built, no? Then it knows what implementations exist, and the developer could then decide how to deal with that. Perhaps the dev could decorate the trait impl as overriding all others, overriding one specific impl, etc.

    The orphan rule feels like throwing the baby out with the bathwater.

    You can still trivially violate memory safety without multithreading or concurrency

    Sure, and ideally those cases would be accounted for, or at the very least the dev could annotate each use to turn the borrow checker off for each instance, and that could print something at build time and a linter could flag over it. Unsafe blocks aren’t feasible for everything here.

    A lot of these situations are fine in practice. Give devs the ability to sidestep the rules and take responsibility for the outcome.


  • TL;DR - I didn’t read the whole thing, but I couldn’t help but ask about the elephant in the room: Lua (or another fast scripting language).

    Here’s the workflow:

    1. Write core logic in Rust, and use Lua for everything else
    2. As code stabilizes, port Lua code to Rust
    3. At the end, you have a nice modding API

    You get most of the benefits of Rust, hot reloading, etc, precisely what OP was asking for. You can even use Lua code to break the rules in Rust.

    A good game development language would let me define the optimization level at the module, or even at the individual function level, and preserve as much debug information as possible for these half-optimized builds.

    Yes please!

    dreaded orphan rule

    Yeah, that always struck me as stupid.

    any attempts to make life better for programmers via tools like Casey’s DLL trick—the only tool available, really—are met with the knee-jerk reaction of: That’s unsafe, sounds cursed, and I don’t like it

    As long as it’s not allowed for “production” builds, I don’t see an issue. Why not just have a compiler flag or something that turns it on or off? Then you can be ergonomic in development and principled in production.

    The note about WebAssembly is odd, it’s just slapping a fresh coat of paint over the same abstraction. If you’re communicating with part of your app in WA, congrats, you have a crappier version of the same thing. WA is cool and can be part of the solution, but let’s not clutch our pearls here.

    the focus should be on value types, not memory allocation

    Isn’t that what lifetimes are? You’re proving to the compiler that this can be a value type given it’s known lifetime. If you don’t know how long something will live, it has to go on the heap or you can have memory safety issues.

    async

    I agree and disagree here. On one hand, I do a lot of web dev, so async is really nice in keeping things fast. On the other hand, mixing the two sucks.

    Here’s my wishlist:

    • split stdlib into three parts - core (nostd) , sync, async
    • build the runtime into the stdlib - it’s weird to me that I need a third party lib to use async; let me replace it like I can w/ the memory allocator

    borrow checker

    Yeah, the borrow checker is a bit too strict IMO. Ideally, the borrow checker would only trigger on things that could be run in parallel, such as with threads or async.

    That said, I haven’t had many issues, but I also don’t make games. Generally speaking, copying is fine, which lets you have one place for doing modifications if you can send modifications to some kind of store.

    All that being said, I feel like the real problem here is that OP wants one tool to solve the complete problem. They brush off WebAssembly for some reason. They don’t consider writing a portion in a scripting language. They don’t consider a microservice architecture, where parts can be hot swapped. Etc.

    Rust is great at things it’s great at, so use it for those. Build a system that has stable parts in Rust and unstable parts in something easier to iterate on.

    I didn’t read the whole thing, bit I got pretty far. Maybe I’ll finish later, idk.





  • No, I really don’t like walking for pleasure, I only walk to get places. I bike a lot more, again, to get places. In suburban areas, there are a ton of side streets to take, so as long as I avoid the main arteries and the “arteries” (side streets the locals race down), I’m good.

    Some areas don’t have a ton of options, especially commercial areas like strip malls and whatnot. But generally speaking, there are options. For example, we have one main road where pretty much all the stores are, and cars go quite fast. But there are also alleys behind stores where the big trucks go that are almost always empty and where the employees tend to go on break, so I can avoid a lot of the busy roads and parking lots that way. That works well in suburban areas, whereas in urban areas, those alleys can be a bit sketchy.

    But yeah, it really depends on the area and where you work.




  • I’ve kind of had the opposite experience as you.

    I don’t mind walking in rural areas because there aren’t many cars and people tend to just leave me alone. I have had people ask of I need a ride or something, never had cans thrown at me or anything. Yeah, sidewalks aren’t really a thing, but there’s usually a generous gravel or grass strip next to the roadway. It’s a bit sketchier at night with drunk drivers, but they’re rare enough that you just need to stay aware of approaching cars.

    In suburban areas, if you know the area somewhat, you can avoid 99% of the traffic by taking side streets. Sidewalks are hit and miss, but walking in the road is usually fine since people are watching out for kids amyway. Night is a little sketchy, but it’s mostly teens and you can hear them blaring music and squealing tires from fairly far away.

    Urban areas scare me because population density is way higher so your chances of being in the same place as a criminal is pretty high. I didn’t grow up in the city, so I maybe spending more time there would help me feel more comfortable, but it seems like he bad areas are pretty close to the “regular” areas and it’s possible to accidentally take a wrong turn somewhere and get into trouble. Nights are terrifying since with drunk people on the streets both in cars and as pedestrians. It’s fine if you’re in a nicer/commercial area, not great elsewhere.

    So my order of preference in walking is first rural areas, then suburban areas, and urban areas last. But I’ve spent most of my time in rural and suburban areas, so I admittedly don’t have a ton of experience in urban areas.



  • Eh, I have repurchased some games on Steam after getting them free from Epic. I rarely play them, but sometimes it’s fun to dig through and find something I claimed. It takes like 30 sec on the web, so I do it when I’m in a meeting or something.

    I have to re-login every time

    Really? I don’t. Maybe that’s why I’ve bothered claiming them nearly every week. I just open the web page, click the free game, then check out.

    New games drop every Thursday at 9AM PST, so it’s easy to remember. I WFH Thursday and Friday, so it’s easy to remember to claim it in the morning. But honestly, any day of the week works since it’s one drop per week.

    It’s more frequent during their Christmas sale, and I always forget when it starts, and I don’t care enough to figure it out. So around Christmas, I check the next drop date and when it says the next day, I go on every day.




















OSZAR »