331 karma · joined Oct 24, 2023 (3y ago) · 228 submissions
comment 6mo ago · link · parent
Monad transformers are one solution to this. This lets you write the composition rules for m2 once, and then reuse them for every m1. A solution, but boilerplatey.
I don't understand algebraic effects quite as well, but my understanding is that they do simply compose.
comment 1y ago · link · parent
I think that's the essential point, really... It'd be hard to argue that the rest of Rust isn't overall "better" than C++, but the compromises made to flexibility and ergonomics to achieve memory safety in Rust are the biggest points of contention for Rust critics.
comment 1y ago · link · parent
comment 1y ago · link · parent
I would not let the name distract you - it's equivalent to overloading, not "generics" (i.e. parametric polymorphism)
In that capacity I think it's quite a lot more sane than C++. Having a closed set of overloads, not having name mangling, not having complex name lookup rules are all a good thing.
comment 1y ago · link · parent
C99 §6.7.2.1.13
> Within a structure object, the non-bit-field members and the units in which bit-fields reside have addresses that increase in the order in which they are declared. A pointer to a structure object, suitably converted, points to its initial member (or if that member is a bit-field, then to the unit in which it resides), and vice versa. There may be unnamed padding within a structure object, but not at its beginning
C99 §6.7.2.1.13
> An implementation may allocate any addressable storage unit large enough to hold a bit-field. If enough space remains, a bit-field that immediately follows another bit-field in a structure shall be packed into adjacent bits of the same unit. If insufficient space remains, whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is implementation-defined. The order of allocation of bit-fields within a unit (high-order to low-order or low-order to high-order) is implementation-defined. The alignment of the addressable storage unit is unspecified.
Which is standardese for pretty much exactly everything you said :)
The consequence of the first rule is that there's only one sane way to lay out structs. The only way to break that rule which I can imagine would be to add extra padding - you can't swap the order of any members under these rules.
comment 1y ago · link · parent
The 3DS also had a note-keeping system built into the main menu and usable in any game, but I don't think many people bothered.
comment 1y ago · link · parent
I would not say that the first gen of Zen is was a clear winner over Skylake. It took a couple iterations before AMD clearly took the lead. AMD was simply so far behind that several large generational improvements were needed to do better than Intel.
comment 1y ago · link · parent
It's been years and years since I ever felt like my phone's performance was holding back its usefulness to me. I have only ever replaced my phone because the battery could no longer hold a charge or the charging port was damaged beyond use.
It has a camera, web browser, chat apps, and receives emails. It also makes calls and texts. It doesn't lag while doing these things. That's plenty.
comment 1y ago · link · parent
EDIT: Following one of the reference links, apparently you can enter Jazelle mode on the Nintendo 3DS's application cores. That's another suitable target. https://github.com/SonoSooS/libjz
comment 1y ago · link · parent
Still, this repo links to some other stuff I found interesting. The Starlet exploit which is linked is funny for how basic it is, and it also seems to be part of a much bigger and more ambitious (but mothballed?) project.
comment 2y ago · link · parent
> Now imagine that calls could specify alternate return points, letting the callee decide the statement to return to:
// Dreamed-up syntax
fn f() {
g() alternate |x| {
dbg!(x); // x = 123
};
}
fn g() -> () alternate i32 {
return_alternate 123;
}
This sort of nonlocal control flow immediately calls to mind an implementation in terms of continuation passing style, where the return point is given as a function which is tail called. Nonlocal returns and multiple returns are easy to implement in this style.Does there exist a language where some function
fn foo() -> T throws U
is syntactic sugar for something more like? fn foo(ifOk: fn(T) -> !, ifExcept: fn(U) -> !) -> !comment 2y ago · link · parent
I encourage you to watch this video where Microsoft describes the security design of the Xbox One, which so far has been almost bulletproof.
comment 2y ago · link · parent
The PS2 EE also had a nasty bug which would cause some loops to terminate early. There's a decent chance any random MIPS code would satisfy this bug's conditions.
https://lore.kernel.org/all/d59a6bef6541d35d4460b966c0fe651a...