HNHacker News
TopNewBestAskShowJobs

GrantMoyer

2,239 karma · joined April 3, 2024

submissionscomments
GrantMoyer··on Matt Godbolt sold me on Rust by showing me C++
C++ has this[1], kind of, but please don't actually use it.

> for_each(a.begin(), a.end(), std::cout << _1 << ' ');

Also, Scala has something similar as a first class feature[2].

[1]: https://www.boost.org/doc/libs/1_88_0/doc/html/lambda.html

[2]: https://scala-lang.org/files/archive/spec/3.4/06-expressions...

GrantMoyer··on Sea snail teeth top Kevlar, titanium as strongest material (2015)
The Nature article's motivation seems not very well thought out to me, considering the fishing industry is among the most unsustainsbly and polluting industries on earth. It's even an especially large source of ocean plastics.
GrantMoyer··on A Pixel Is Not a Little Square (1995) [pdf]
People get caught up on display technology, but how pixels are displayed on a screen is irrelevant. From a typical viewing distance and with imperfect human lenses, a point impulse and a little square are barely distingishable. The important part is that thinking about pixels as little squares instead of points makes all the math you do with them harder for no benefit.

Consider the Direct3D rasterization rules[1], which offset each sample point by 0.5 on each axis to sample "at the pixel center". Why are the "pixel centers" even at half-integer coordinates in the first place? Because if thinking of pixels as little squares, it's tempting to align the "corners" with integer coordinates like graph paper. If instead the specifiers had thought of pixels as lattice of sample points, it would have been natural to align the sample points with integer coordinates. "Little square" pixels resulted in an unneeded complication to sampling, an extra translation by a fractional distance, so now every use of the API for pixel perfect rendering must apply the inverse transform.

[1]: https://learn.microsoft.com/en-us/windows/win32/direct3d11/d...

GrantMoyer··on Getting forked by Microsoft
> And I want others to be able to remix what I make as needed. The more limitations added on a license, the less open it is.

It's unintuitive, but permissive licenses are not the best way to acheive this. GPL's "limitations" are designed to maintain the right and abilty to remix code for the end user. So if say Microsoft forks your library and its fork becomes more popular, they can't make it proprietary after capturing the market and effectively stop people from remixing what you made.

GrantMoyer··on Novel color via stimulation of individual photoreceptors at population scale
Blue light looks different from violet light, because blue light activates M cones ("green" cones) more than violet light does.
GrantMoyer··on Novel color via stimulation of individual photoreceptors at population scale
This is a common misconception, but the sensitivity of L cones ("red" cones) increases monotonically until about 570nm (monochromatic yellow), so violet light stimulates L cones the least out of all visible wavelengths of light. Magenta light, a mixture of red and blue wavelengths, stimulates L cones far more than violet light. See Wikipedia's LMS responsivity plot[1] or the cone fundamental tables from the Color & Vision Research Laboratory at [2].

I think the misconception comes from plots of XYZ color matching functions[3]. The X color matching function indeed has a local maximum in the short wavelengths, but X doesn't represent L cone stimulation; it's a mathematically derived curve used to define the XYZ color space, which is a linear transform of LMS color space selected for useful mathematical properties.

[1]: https://en.wikipedia.org/wiki/LMS_color_space#/media/File:Co...

[2]: http://www.cvrl.org/

[3]: https://en.wikipedia.org/wiki/CIE_1931_color_space#/media/Fi...

GrantMoyer··on Potatoes in the Mail
Let me elaborate. I'm not saying the OPs story is cruel. I'm saying shipping live animals is cruel. Shipping animals isn't transporting them using some specialized service; it's litterally sending them through the mail system like any other parcel, the same system that regularly damages heavily padded packages. The practice is still common today, especially for live chicks, and many animals die due to the conditions of transport. Their deaths are treated as an expected loss.
GrantMoyer··on Potatoes in the Mail
How cruel.
GrantMoyer··on C++: terser (shorter) lambda == SHORTY (ab-use?)
Another idea in this vein, but with a surprisingly straightforward implementation (27 lines): https://github.com/GrantMoyer/lambda_hpp

I started out trying to write something like the OP, but changed direction when I convinced myself there would have been no sane way to implement member call syntax. I honestly can't decide if it's cursed or genuinely useful (minus the unicode name, that's cursed).

GrantMoyer··on Foreign visits into the U.S. fell off a cliff in March
Don't forget the efforts to legally denounce citizen's citizenship. Right now, it's still unconstitutional, but the point is to test the waters.
GrantMoyer··on Why do we need modules at all? (2011)
I think Hoogle[1] is proof this concept could work. Haskell has modules, of course, but even if it didn't, Hoogle would keep it still pretty usuable.

The import piece here which is mentioned but not very emphasized in TFA is that Hoogle lets you search by meta data instead of just by name. If a function takes the type I have, and transforms it to the type I want, and the docs say it does what I want, I don't really care what module or package it's from. In fact, that's often how I use Hoogle, finding the function I need across all Stack packages.

That said, while I think it could work, I'm not convinced it'd have any benefit over the statys quo in practice.

[1]: https://hoogle.haskell.org/

GrantMoyer··on An image of an archeologist adventurer who wears a hat and uses a bullwhip
All four of those are dressed like Indiana Jones. They look like different versions of Indiana Jones you'd see in super hero multi-verse story.
GrantMoyer··on High‑dose Vitamin D reduces disease activity in early multiple sclerosis onset
Too much Vitamin D can calcify your soft tissues, so be cateful following some of the reccomendations in these comments.

https://en.wikipedia.org/wiki/Vitamin_D#Excess

GrantMoyer··on Crabtime: Zig’s Comptime in Rust
Off the top of my head:

- There's both undefined and null

- There's three ways to declare variable

- typeof vs instanceof

- for in vs for of

- the way `this` works

- semantics of functions called with the wrong number of args

There's far more that I can't immediately recall.

GrantMoyer··on Crabtime: Zig’s Comptime in Rust
Nit-pick: Javascript is not simple; I personally think it has among the most complex language semantics out of all commonly used languages.
GrantMoyer··on Don't Be Afraid of Types
The types of closures are unnamable in C++ and Rust; each closure has a unique type that can't be written out. Function types (that is, "function item" types) in Rust are also unnamable.
GrantMoyer··on Going down the rabbit hole of Git's new bundle-URI
Getting better: https://git-scm.com/docs/partial-clone
GrantMoyer··on Mozilla reverses course on its terms of use
I don't understand your comment. I didn't say or suggest a browser only renders HTML. Are you saying Mozilla did?
GrantMoyer··on Mozilla reverses course on its terms of use
The whole clause is weird because Mozilla doesn't operate Firefox; the user does. So at face value, "you give Mozilla the rights necessary to operate Firefox" means you give Mozilla no rights, but obviously that's not the intent. Then they explicitly list a couple examples, but don't say the granted rights are limited to those examples, so the clause could mean practically anything.

I'm curious if any lawyers can comment on how courts would be likely to interpret the clause.

GrantMoyer··on Speedrunners are vulnerability researchers, they just don't know it yet
I also think a lot of speedrunnimg tecniques demontrate the "anything can happen" nature of undefined behavior in an viscerally, not-purely-theoretical way. What happens when you don't take undefined behavior seriously? Well, then Mario can backward longjump into a parallel universe and teleport enemies on a whim.
GrantMoyer··on Video encoding requires using your eyes
The thing is there's not much nuance to be had. Netflix's approach is just worse than existing best approaches on all axes.
GrantMoyer··on An update on Mozilla's terms of use for Firefox
Each update from Mozilla about this issue has Mozilla claiming users are confused (which may be true; I don't follow the larger social media ecosystem), then doubling down on the part I'm personally concerned about.

I'm worried that Mozilla is asserting it needs a license for the information input into Firefox for Firefox to do it's job, since that's factually untrue. So either Mozilla is genuinely confused about this point, which I find unlikely, or they have some ulterior motive. I can't say with any confidence what the ulterior motive is, but I can be pretty sure there is one, and that worries me about the future of the browser landscape.

GrantMoyer··on An update on Mozilla's terms of use for Firefox
More like Bic needs unrestricted access to your letters so their pen can write them for you.
GrantMoyer··on Mozilla's new terms of use are out of step with Firefox's direct competition
Sure, but neither Distribution Policy for Mozilla Software[1] nor Mozilla Trademark Guidelines[2] make any mention of the Terms of Use. Services Firefox connects to have their own Terms of Service, like you say, but those are unrealated to Terms of Use for Firefox itself.

[1]: https://www.mozilla.org/en-US/foundation/trademarks/distribu...

[2]: https://www.mozilla.org/en-US/foundation/trademarks/policy/

GrantMoyer··on Mozilla's new terms of use are out of step with Firefox's direct competition
The term itself is bad here. The problem isn't just because it's hard to understand.

> Second clause establishes that when you input that data you give firefox a license to that data which you otherwise own

Firefox doesn't need a license, because it's not a legal entity; it's software acting on behalf of a person (the user).

Mozilla doesn't need a license to all information input through Firefox, because Mozilla doesn't need that data for Firefox to operate.

GrantMoyer··on Introducing a terms of use and updated privacy notice for Firefox
Firefox's blog post in the change[1] has an update:

> UPDATE: We’ve seen a little confusion about the language regarding licenses, so we want to clear that up. We need a license to allow us to make some of the basic functionality of Firefox possible. Without it, we couldn’t use information typed into Firefox…

Uh, yeah, that's exactly the problem. Mozilla shouldn't be allowed to use all the information I type into Firefox at all. Mozilla doesn't need any rights for Firefox to process my data locally on my behalf, or even for Firefox to send my data to third parties on my behalf (ex. instant search suggestions). Those aren't Mozilla using my information; those are me using my information using Firefox.

They would only "need" extra rights to collect data and process it on their servers for unspecified purposes. They do legitimately process some data on their servers, such as Firefox Sync data, but that's already covered under the Mozilla account terms of service. There's no need for a broad license for all data going through Firefox.

[1]: https://blog.mozilla.org/en/products/firefox/firefox-news/fi...

GrantMoyer··on Introducing a terms of use and updated privacy notice for Firefox
Firefox's own about:license page (reachable through the about firefox dialog) says the sources are available under a wide variety of open source licenses. Does that mean only Mozilla distributed binaries are governed by the "Firefox Terms of Use"? If I download Firefox through my distro package manager, and the distro infrastructure compiled and distributed it undet the terms of the open source licenses, presumably I may use the software solely under the terms of those open source licenses.

Does Mozilla take this into account, or do they act as if they have the rights they assert in the ToU, regardless of what license a Firefox user is using the software under?

GrantMoyer··on Is this the simplest (and most surprising) sorting algorithm ever? (2021)
> If it was restricted to bubbling the maximum or minimum to the end of the list, the full sort would use one bubble, it would complete in linear time, and the list wouldn't be sorted afterwards.

Yes, one bubble op is linear time. A bubble sort is a sequence of bubble ops on the unsorted portion of the list (which shrinks by one for each bubble op).

Meanwhile an insertion sort is a sequence of insertion ops into the sorted portion of a list. So I agree with your analysis, except that the featured sort is a pessimized insertion sort, not a pessimized bubble sort.

> No, a bubble op bubbles one element into the correct position in a sorted list.

Again, that's an insertion op, not a bubble op. I suppose an insertion op can be thought of as equivalent to a bubble op on an element prepended to a sorted list, but it doesn't make sense to call it a bubble op in the context of bubble sort, since bubble sort doesn't do that.

> For our purposes, there is no difference, because we're bubbling into a perfectly sorted list, so once our initial element stops moving, nothing else can move.

I think this is where you're going wrong. In a bubble sort, a bubble op is never run on a sorted list + 1 element. Instead, it's run only on the unsorted portion of the list.

GrantMoyer··on Tuta Launches Post Quantum Cryptography for Email (2024)
Last time I checked, while tutanota's emails are ostensibly E2E encrypted, all public keys are provided by their server and there's no way to pin keys or verify them over a side channel, so a compromised server could trivially send its own public keys and MITM attack all encrypted emails.

This completely defeats the purpose and guarantees of E2E encryption, but for some reason, it hasn't seemed to be a priority for them. The article passingly mentions key verification, so hopefully that's changed.

https://github.com/tutao/tutanota/issues/768

GrantMoyer··on Is this the simplest (and most surprising) sorting algorithm ever? (2021)
Your step 3 is an insertion op, not a bubble op.

An insertion op inserts one element into a sorted list. A bubble op bubbles the maximum (or minimum) element to the end of an unsorted list.

← PreviousPage 3 of 12Next →