sapphicfettucine

software catgirl

kore signet-yang

trans, plural, philosophy student, bass player
excerpt «» developer «» digital archivist
wife to @ceolia <3


blog blog blog
blog.cat-girl.gay/

hthrflwrs
@hthrflwrs

[starting to work with xml] i hate this, this sucks, i wanna have a gui again
[three months later] I LOVE XML I LOVE XML I LOVE XML


hthrflwrs
@hthrflwrs

i love that i can store ALL of a character's data in the same place, and then reference it in several different locations to show different aspects of that same character. the amount of data i need to store to generate the majority of "scenes" is so small it can fit in a single screenshot. i love this shit


sapphicfettucine
@sapphicfettucine

the hating XML & loving JSON -> loving XML & hating JSON pipeline



myrrlyn
@myrrlyn

would that be fucked up or what

so as you may or mayn't know, i am the author of the funty crate, which re-unifies all the primitives under a trait hierarchy so you can be generic over them, and i also experimentally am working on plugging pointer permissions into the type system with a module in bitvec.

incidentally this is what is colloquially known as "terminal library author brain", not as in "author of libraries for the terminal" but as in "incurable". if i ever learn haskel it is Over for you bitches

anyway

rust 1.65 has Generic Associated Types

which means i get to do incredibly brain genious shit like this:

trait Permission {
  type Raw<T: ?Sized>: Copy;
}

struct Shared; struct Unique;

impl Permission for Shared {
  type Raw<T: ?Sized> = *const T;
}
impl Permission for Unique {
  type Raw<T: ?Sized> = *mut T;
}
// this is a surprise tool that will help us later :)
impl Permission for (Shared, Unique) {
  type Raw<T: ?Sized> = <Shared as Permission>::Raw;
}

and not have to make Permission, or worse, Shared and Unique, generic over the type of the referent. cool, right? but wait. check this shit out:

trait Permission {
  // snip
  type Const: Permission;

  fn cast_const<T: ?Sized>(ptr: Self::Raw<T>) -> <Self::Const as Permission>::Raw<T>;
}

impl Permission for Shared {
  // snip

  type Const = Self;

  fn cast_const<T: ?Sized>(ptr: *const T) -> *const T { ptr }
}
impl Permission for for Unique {
  // snip

  type Const = (Shared, Self); // see? i told you

  fn cast_const<T: ?Sized>(ptr: *mut T) -> *const T { ptr.cast_const() }
}
impl Permission for (Shared, Unique) {
  // snip

  type Const = Self;

  fn cast_const<T: ?Sized>(ptr: *const T) -> *const T { ptr }
}

you may be thinking "alex what the fuck is this shit" which is fair. the fuck that this shit is, is that it's a type-system graph that allows you to at compile time prove that you can take a mutable pointer and dynamically degrade it to a const pointer and later re-upgrade it to mutable while completely disallowing upgrading const-only pointers to mutable. i'm not showing you a (Shared, Unique) -> Unique phase change because that's boring and you get the idea, but, yeah. if i don't define a (Shared) -> Unique phase change then you can never sneak mutability into a pointer that doesn't have it.

people keep telling me that the rust generic system is turing complete which means i am going to port miri to it

because i am fucking insane