Really thanks for additional info from Rust world. context is a constructor for contexts in Rye, which are important, so that is not what fits. Also check doesn't just wrap - provide context, basically most of the time, in the happy path, it just passes value, check has some fell of optionality IMO, like check-but-go-on ... so this seems to me it fits.
I am not too fond of assert ... I know it's used for similar mechanism in unit tests, but naturally I understand it to have a slightly different meaning. Betwen ensure and assert is assure. Does any eng. speaker have an oppinion on that word?
"notebookcheck.net" uses that shitty anti-ad-blocker Javascript bull. If you switch to "reader" before that pop-up comes up, you can see the article without the ads :)
What surprises me here is how recent the CPUs are that're affected. In spite of how recent they are, Intel doesn't intend to provide fixes, it seems.
I've been warning people to avoid Intel for ages, and the proof of it came with their CPU degradation issues, but the reason has been around for ages: Intel relies on tricks and hacks, whether it's questionable voltages, multi-hundred watt power draw, or the kinds of issues that meant Spectre and Meltdown affected Intel CPUs much more than other processors.
Intel really needs to compete, so here's to hoping whatever they release at CES isn't impressive because of design decisions that'll end up causing premature death or huge slowdowns in a few years.
letters/ideograms themselves are used for artistic effect, something which isn’t really a thing with latin alphabets.
Or rather, it’s much less of a thing: we do have illuminated letters, monograms, sometimes-artistic logotypes, and the occasional ambigram. Who remembers the exuberant typography of Wired magazine in the 1990s?
On the other hand, how might e. e. cummings have laid out his poetry if he wasn’t constrained by the capabilities of Linotype machines?
Do you then deploy from CI, or from your workstation? I switched to pull-based (comin) because I didn’t want CI to have access to the hosts, so curious how you’re doing it.
There are things that can be both mutually exclusive and yet simultaneously true in different situations. In the case of RNGs it’s true that the default RNG should be secure so that it’s safe against accidental misuse (which is what you are advocating) but it’s also true that many applications are not vulnerable to the kinds of attacks that safe RNGs defend against. Some of those applications need things like reproducibility (which implies unsafe seeding), and better performance than a cryptographic RNG can provide. (Or maybe different performance, preferring lower small-block latency rather than higher large-block throughput.)
The same kind of thing occurs with hash functions: the default should defend against HashDoS attacks (eg Rust std uses SipHash) but in many cases it’s worth using something faster when it isn’t exposed to an adversary (eg rustc uses fxhash). Or for another example, when aesni is used for hashing in ahash, the number of rounds is drastically reduced so that its performance is acceptable.
Font rendering is a nightmare on computers, but as a boring speaker of Romance languages, I find it such a fascinatingly complex expression of human culture. What would computers, or keyboards, or word processors, have looked like if they had been invented by Urdu speakers (see slide 27)?
Also it’s no wonder that Arabic or Japanese or Chinese cultures have such a focus on calligraphy and the artistry of it; letters/ideograms themselves are used for artistic effect, something which isn’t really a thing with latin alphabets.
I have seen "ensure" used in this sense in one error handling library, snafu in Rust, but I agree with @roryokane that "ensure" does not quite capture the intended meaning either.
I think "check" would be a clearer name for this function than it is for the function ^check in the article,¹ although "check" is a very generic name.
Ultimately, using the traditional name "assert" might be most helpful to users.
¹ What you name "^check" seems to correspond to what Rust error handling libraries typically name "context". I think "context" is clearer, although that is as a method of an error-handling-related type, not as a free function.
For slow vector instructions (e.g. gather/scatter), the issue-to-retirement worst-case latency is different in principle since like string instructions (e.g. rep movsb) they are explicitly designed with interruptible semantics: those instructions can be partially executed, interrupted, and resumed since they leave a trail of their progress in the architectural state (e.g. rcx/rsi/rdi for rep movsb and partially cleared vector mask bits for gather/scatter). Whether a given microarchitecture takes advantage of that fine granularity for non-string instructions is another matter. It seems like the right question is about the longest non-preemptible span of time for a given instruction, although I'll have to go watch that video you linked.
I would love to see an article on your ideas, please write them up.
In the mean time I feel like your ideas have nothing to do with the article and it's an intrusion when someone says "let's think about an interesting possibility that Nix enables" to arrive with "yeah but most people aren't going to use Nix and here's something unrelated that might also be good."
You’re carrying a single value instead of 4 (element, event, callback, capture mode), you can hook abort signals into more locations if you want to sync up the removal with other things, you can receive cancellation notifications, …
Agreed. @LucidLynx this is a cool article, but you should consider re-running these benchmarks on a plugged-in machine with "High Power" on macOS or "performance" on Linux. Otherwise the OS's CPU scheduler and frequency scaling logic will affect the output.
Thanks for the feedback. I'm not a native En speaker and ensure made the most sense to me, but I also wasn't really sure about the ensure vs assure. I know for assert only from programming lingo, and didn't seem that natural to me otherwise.
Now I'm reading the definition of ensure: Ensure means to make sure something happens
So your feedback is certanly correct, as it seems that ensure means that action is taken ... I will think / read more about it. Any further feedback is also welcome. What do you think about assure? If I don't find a better one, assert is probably the one I will switch to.
At the start I think this function was named require btw ...
As the other top level comment suggests the nice, useful and interesting thing about this article is that those higher level libraries / tools / etc are kind of the default, so there's an abundance of materials on them. There's relatively little materials on how to build up those layers in the first place though.
You opinion is that "expressing intent" on itself is not really valuable in programming, OK. My opinion is that it is. In same manner as using good function and variable names is. It makes code easier to comprehend. But we can have different opinions on "intent", I'm not trying to change yours.
If you don't think there is value in that, then you probably also won't think there is value in these constructs for failure handling in Rye, yes.
You say that map and filter have concrete advantages. It would be interesting to know what are these advantages then in your opinion. I can also think of some, but it would be interesting to know what you mean in this case.
Really thanks for additional info from Rust world.
contextis a constructor for contexts in Rye, which are important, so that is not what fits. Alsocheckdoesn't just wrap - provide context, basically most of the time, in the happy path, it just passes value, check has some fell of optionality IMO, like check-but-go-on ... so this seems to me it fits.I am not too fond of assert ... I know it's used for similar mechanism in unit tests, but naturally I understand it to have a slightly different meaning. Betwen ensure and assert is
assure. Does any eng. speaker have an oppinion on that word?"notebookcheck.net" uses that shitty anti-ad-blocker Javascript bull. If you switch to "reader" before that pop-up comes up, you can see the article without the ads :)
What surprises me here is how recent the CPUs are that're affected. In spite of how recent they are, Intel doesn't intend to provide fixes, it seems.
I've been warning people to avoid Intel for ages, and the proof of it came with their CPU degradation issues, but the reason has been around for ages: Intel relies on tricks and hacks, whether it's questionable voltages, multi-hundred watt power draw, or the kinds of issues that meant Spectre and Meltdown affected Intel CPUs much more than other processors.
Intel really needs to compete, so here's to hoping whatever they release at CES isn't impressive because of design decisions that'll end up causing premature death or huge slowdowns in a few years.
Or rather, it’s much less of a thing: we do have illuminated letters, monograms, sometimes-artistic logotypes, and the occasional ambigram. Who remembers the exuberant typography of Wired magazine in the 1990s?
On the other hand, how might e. e. cummings have laid out his poetry if he wasn’t constrained by the capabilities of Linotype machines?
Do you then deploy from CI, or from your workstation? I switched to pull-based (comin) because I didn’t want CI to have access to the hosts, so curious how you’re doing it.
Also, previously including a link to POC code. (Failed to find that earlier since I couldn’t remember the keywords that appeared in the title…)
OK, that makes a lot more sense. So it's a bit power law like, where a few frequent fliers are responsible for a large slice of the pie.
Oh, and I just remembered Crocotile
There are things that can be both mutually exclusive and yet simultaneously true in different situations. In the case of RNGs it’s true that the default RNG should be secure so that it’s safe against accidental misuse (which is what you are advocating) but it’s also true that many applications are not vulnerable to the kinds of attacks that safe RNGs defend against. Some of those applications need things like reproducibility (which implies unsafe seeding), and better performance than a cryptographic RNG can provide. (Or maybe different performance, preferring lower small-block latency rather than higher large-block throughput.)
The same kind of thing occurs with hash functions: the default should defend against HashDoS attacks (eg Rust std uses SipHash) but in many cases it’s worth using something faster when it isn’t exposed to an adversary (eg rustc uses fxhash). Or for another example, when aesni is used for hashing in ahash, the number of rounds is drastically reduced so that its performance is acceptable.
Font rendering is a nightmare on computers, but as a boring speaker of Romance languages, I find it such a fascinatingly complex expression of human culture. What would computers, or keyboards, or word processors, have looked like if they had been invented by Urdu speakers (see slide 27)?
Also it’s no wonder that Arabic or Japanese or Chinese cultures have such a focus on calligraphy and the artistry of it; letters/ideograms themselves are used for artistic effect, something which isn’t really a thing with latin alphabets.
Yes this article was very interesting indeed!
Also Blockbench
Using the word "assert" for this is common, but I agree with you that the plain English meaning of the word fails to imply "or return with failure".
I have seen "ensure" used in this sense in one error handling library,
snafuin Rust, but I agree with @roryokane that "ensure" does not quite capture the intended meaning either.I think "check" would be a clearer name for this function than it is for the function
^checkin the article,¹ although "check" is a very generic name.Ultimately, using the traditional name "assert" might be most helpful to users.
¹ What you name "^check" seems to correspond to what Rust error handling libraries typically name "context". I think "context" is clearer, although that is as a method of an error-handling-related type, not as a free function.
For slow vector instructions (e.g. gather/scatter), the issue-to-retirement worst-case latency is different in principle since like string instructions (e.g. rep movsb) they are explicitly designed with interruptible semantics: those instructions can be partially executed, interrupted, and resumed since they leave a trail of their progress in the architectural state (e.g. rcx/rsi/rdi for rep movsb and partially cleared vector mask bits for gather/scatter). Whether a given microarchitecture takes advantage of that fine granularity for non-string instructions is another matter. It seems like the right question is about the longest non-preemptible span of time for a given instruction, although I'll have to go watch that video you linked.
I would love to see an article on your ideas, please write them up.
In the mean time I feel like your ideas have nothing to do with the article and it's an intrusion when someone says "let's think about an interesting possibility that Nix enables" to arrive with "yeah but most people aren't going to use Nix and here's something unrelated that might also be good."
You’re carrying a single value instead of 4 (element, event, callback, capture mode), you can hook abort signals into more locations if you want to sync up the removal with other things, you can receive cancellation notifications, …
Agreed. @LucidLynx this is a cool article, but you should consider re-running these benchmarks on a plugged-in machine with "High Power" on macOS or "performance" on Linux. Otherwise the OS's CPU scheduler and frequency scaling logic will affect the output.
ensureis pretty commonly used as a synonym for "postcondition" in formal methods literature and Design by Contract.Thanks for the feedback. I'm not a native En speaker and
ensuremade the most sense to me, but I also wasn't really sure about the ensure vsassure. I know forassertonly from programming lingo, and didn't seem that natural to me otherwise.Now I'm reading the definition of ensure: Ensure means to make sure something happens
So your feedback is certanly correct, as it seems that ensure means that action is taken ... I will think / read more about it. Any further feedback is also welcome. What do you think about assure? If I don't find a better one, assert is probably the one I will switch to.
At the start I think this function was named
requirebtw ...As the other top level comment suggests the nice, useful and interesting thing about this article is that those higher level libraries / tools / etc are kind of the default, so there's an abundance of materials on them. There's relatively little materials on how to build up those layers in the first place though.
You opinion is that "expressing intent" on itself is not really valuable in programming, OK. My opinion is that it is. In same manner as using good function and variable names is. It makes code easier to comprehend. But we can have different opinions on "intent", I'm not trying to change yours.
If you don't think there is value in that, then you probably also won't think there is value in these constructs for failure handling in Rye, yes.
You say that map and filter have concrete advantages. It would be interesting to know what are these advantages then in your opinion. I can also think of some, but it would be interesting to know what you mean in this case.