2,338 karma · joined Nov 9, 2012 (14y ago) · 582 submissions
comment 1w ago · link · parent
You can also get savings by using the "store and increment HL" combined instruction, which saves time over "inc HL", but this requires you to move from the popped registers into A (this instruction only works with the A register). You can't pop directly into the A register because that pop variant, "pop AF", pops into A plus the hidden flags register which is not helpful.
So it looks like:
pop DE
ld A, D
ld [HL+], A
ld A, E
ld [HL+], Acomment 6mo ago · link · parent
comment 7mo ago · link · parent
And yet this is exactly what happens if you exceed a quota limit, which aren't always well signposted and sometimes require days to get the limit raised. I've experienced multiple hours-long outages due to hitting GCP quotas we didn't know existed.
comment 9mo ago · link · parent
type Option<T> = T | undefined
function f<T>(value: T): Option<T> { ... }
let thing: string | undefined = undefined;
let result = f(thing);
Now imagine the definition of Option is in some library or other file and you don't realize how it works. You are thinking of the Option as its own structure and expect f to return Option<string | undefined>. But Option<string | undefined> = string | undefined | undefined = string | undefined = Option<string>.The mistake here is in how Option is defined, but it's a footgun you need to be aware of.
comment 1y ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
comment 1y ago · link · parent
#!/bin/sh
foo
bar
vs #!/bin/sh
foo
exec bar
And you could perhaps imagine a shell that does "tail process elimination" to automatically perform the latter when you write the former.But the distinction can be important due to a variety of side effects and if you could only achieve it through carefully following a pattern that the shell might or might not recognize, that would be very limiting.
comment 1y ago · link · parent
comment 1y ago · link · parent
In my preferred model of on-call, you have a primary, then after 5min an escalation to secondary, then after 5min an escalation to something drastic (sometimes "everyone", sometimes a manager).
The expectation is that most of the time you should be able to respond within 5 minutes, but if you can't then that's what the secondary role is for - to catch you. This means it's perfectly acceptable to go for a run, go to a movie, etc.
You relax the responsibility on the individual and let a sensible amount of redundancy solve the problem instead. Everyone is less stressed, and sure you get the occasional 5min delay in response but I'm willing to bet that the overall MTTR is lower since people are well rested and happier to be on call to begin with.
comment 1y ago · link · parent
This is more or less what the RfL folks are asking for - they have a Rust API to be used by other Rust code, which uses the existing C API, and are promising to maintain that API themselves. It lives in the Rust "directory".
The C maintainer is rejecting this, seemingly because his goal isn't to find a compromise that works but to completely block the project.
comment 1y ago · link · parent
eg. I need to dismiss a dialog that is invisible over remote play, or it won't finish logging in until I close a "finish setting up your windows install" screen.
comment 1y ago · link · parent
comment 1y ago · link · parent
So it sounds like Mastodon was run by a non-profit, but the non-profit ran afoul of some legal issues, and they're now creating a fixed version? This seems to be administrative details, not news.
comment 1y ago · link · parent
comment 1y ago · link · parent
To clarify, I never intended that as a defence of FPTP. It's awful and I'll take any of the systems being discussed here over it. It was a statement specifically towards IRV over score/approval.
comment 1y ago · link · parent
As the article mentions, in the real world score voting would just be approval voting where you put a max score on some choices and 0 on others.
And in approval voting you need to think about how others will vote and pick your cutoff point based on who you think has a chance - do you vote "yes" for the center-right party to avoid the hard right party getting in? Or do you vote "no" to help the center-left party beat the center-right party? (swap those directions to personal preference)
RCV isn't perfect, but in all but the smallest elections there's really no practical strategic voting considerations. You just state your true preference order.
Of course, I'll take any of them over FPTP.
comment 1y ago · link · parent
Suppose we had a version of the ? operator that automatically appended a call stack to the error value returned. Are you saying that that's not "an exception" because I still need to write ? after each falliable function? Or because it's still part of the return type? Or is it specifically only an exception if it works via stack unwinding?
comment 1y ago · link · parent
The problem is that "unrecoverable constraint violations" happen a lot in practice when you're dealing with filesystems, networking...anything that isn't pure computation.
Suppose I have a function that calls other functions that themselves make 3 database queries, two HTTP requests, and reads/writes from a cache directory. It considers all of them (except perhaps the caching) unrecoverable in the context of that function. What should it do?
I see three reasonable options:
(1). return a simple error type saying "Networking failure", "IO Error", etc if any of those fail
(2). return a complex error type that exposes the internal details of all the different things it's doing and which one failed and why
(3). panic if any of them fail
I would argue that (1) is unfit for purpose as you have no idea what's actually going wrong.
And (3) is currently very heavily discouraged, though I think if I'm understanding your argument right it probably makes the most sense. However it leaves your top-level function in the awkward position of needing to make that panic part of its API contract, without the type system to help. It's also highly limiting because the caller now can't distinugish between programmer errors and possibly-transient environmental conditions like a service outage.
(2) is what I'd expect to see in practice right now, and that's what leads to these automatic stack traces, etc. But none of these feel like good options. Ideally I'd want something that is:
- Debuggable (like (2) and (3))
- Part of the type system (like (1) and (2))
- Still allows introspection by the caller (like (1) and (2))
- Doesn't require a ton of boilerplate at each level (like (3), and possibly (1))
(edited for formatting)
comment 1y ago · link · parent
But then people realised that 99% of the time you just want to handle the error by passing it upwards, and so ? was invented.
But then people realised that this loses context of where the error occured, so now we're inventing call stacks.
So it seems that what people actually want is errors that by default get transferred to their caller and by default show the call stack where they occured. And we have a name for that...exceptions.
It seems that what we're converging towards is really not all that different from checked exceptions, just where the error type is an enum of possible errors (which can be non-exhaustive) instead of a list of possible exception types (which IIUC was the main problem with java's checked exceptions).
comment 2y ago · link · parent
The first is that citizens have a say in who governs them. If the government does something they don't like, they can (at least in theory) vote for someone who will change it.
The second is that in most legal systems, there are differences in what governments are allowed to do and what corporations are allowed to do. For example, a government may be required to provide services to all citizens, whereas a corporation has the right to not serve certain people (such as "people who don't own a smartphone").
These differences aren't insurmountable, but it's something to keep in mind.
comment 2y ago · link · parent
The first is JSON as a data encoding, ie. the particular syntax involving braces and quotes and commas and string escapes.
The second is JSON as a data type, ie. a value which may be a string, number, bool, null, array of such values, or map from string to such values. The JSON data type is the set of values which can be represented by the JSON data encoding.
The article describes an optimized storage format for storing values which have the JSON data type. It is not related to JSON the data encoding, except in that it allows input and output using that encoding.
This is the same thing as postgres' JSONB type, which is also an optimized storage format for values of the JSON data type (internally it uses a binary representation).
29.
UndefinedBehaviorSanitizer's Unexpected Behavior(daniel.haxx.se ↗)
48 points · by ekimekim · 2y ago · 91 comments
comment 2y ago · link · parent
As a fun exercise, you can do this for all 2-bit -> 1-bit functions. There's only 16 of them, and most of them have very well known names like "and" (LUT 1000) or "xor" (LUT 0110). Some of them don't depend on some of the inputs (eg. LUT 1100 / 1010 which is "return A" and "return B" respectively) or even any of them (eg. LUT 0000 which always returns 0).