HNHacker News
TopNewBestAskShowJobs

esprehn

2,029 karma · joined July 18, 2011

submissionscomments
esprehn··on Go 1.21 may have a clear(x) builtin
The answer is lack of generics in all previous versions of Go. There's no way to express a generic interface to have methods for map or slice (which are not interfaces, but compiler magic instead). All the operations on builtin types must be implemented as globals handled by the compiler.
esprehn··on Show HN: Xq – command-line XML and HTML beautifier and content extractor
The issue with CSS selectors is they can only express element selection. There's no concept of picking the text of the element or the value of an attribute. There's been proposals over the years to support pseudo elements for that, so you could make something up like ::attr(name) and ::text, but nothing in the standards.

htmlq does this by having various command line options like --attribute and --text.

https://github.com/mgdm/htmlq#examples

esprehn··on Ask HN: Is React impacted by Meta layoff?
Is that all still true with modern react? By the time you explain the rules of hooks, concurrent mode and its hooks, and RSC I think the only one that's true is (3).
esprehn··on The Sad Saga of the 500 MHz Power Mac G4
It doesn't seem like it:

https://lowendmac.com/tech/internalfw.shtml

I think you could put a storage drive inside the case maybe, or a rail mount bay. I never heard of anyone using that port.

esprehn··on Maps and Memory Leaks in Go
That's easily resolved with an ensureCapacity(size) method, or the other way around with shrinkToFit(size).

maps being magic without a real interface means exposing new API surface is difficult though.

esprehn··on Is Turbopack really 10x faster than Vite?
Turbopack is alpha, it seems fair to benchmark against an alpha configuration of vite. It sounds like they're considering changing the default, but were uncertain it helped most users today.
esprehn··on Remix web framework aquired by Shopify
Some could argue the just okay docs were driving consulting business. Even the TFA mentions they started conversations with them because they were using react router! :p
esprehn··on Remix web framework aquired by Shopify
Michael and Ryan have always been about trying to make money from their React expertise. They literally created a company called React Training: https://reacttraining.com/team and have had a fairly lucrative business doing workshops for years.

No harm in trying to get folks to pay for a framework. It doesn't seem it worked, but I can't fault them for trying!

esprehn··on No safe efficient ways to do three-way string comparisons in Go
Yeah, that's a pretty small amount of clean up. Someone should try to revert the patch and reland it.
esprehn··on No safe efficient ways to do three-way string comparisons in Go
The optimal version does seem to exist here (per the comment too):

https://github.com/golang/go/blob/d28bf6c9a2ea9b992796738d03...

So the goal was to intentionally nerf Compare() to discourage code the golang authors considered less clear. I'm not sure bad performance is really discouraging usage though, it just penalizes folks that use stdlib.

I wonder if they'd accept a PR to switch to runtime.cmpstring today?

esprehn··on Programming language comparison by reimplementing the same transit data app
This was fun to read through.

I would need to profile the code, but the startup time being bad for Deno seems like maybe a combination of the code in here being unoptimized:

https://github.com/denoland/deno_std/blob/0ce558fec1a1beeda3...

(Ex. Lots of temporaries)

And usage of the readFileSync+TextDecoder API instead of readTextFile (which is also a docs issue since it suggests the first one). It seems the code loads the 100MB into memory, then converts to another 100MB of utf8, then parses with that inefficient csv parser. The rust and go versions look to be doing stream/incremental processing instead.

esprehn··on Texas sues Google for collecting biometric data without consent
What part of this is surveillance though? Within a particular Google Photos account the faces of humans (and pets) are identified and then labeled by the account owner. Google doesn't match faces across accounts, doesn't use the data for ads, and is doing effectively what a human could do by scrolling through the photos and manually circling faces with a pen.
esprehn··on Google is forcing us to make our open source VoIP app worse
That sounds like iOS? Only Apple apps have access to all the system level capabilities and you can't replace any of the system apps, not even the browser.
esprehn··on Google is forcing us to make our open source VoIP app worse
Why do you need to know every app installed on the device to invite people you know?
esprehn··on As Covid hit, Washington officials traded stocks with exquisite timing
I grew up there and live there currently. Everyone I know either says "DC", "the district" or "the city" depending on the context. Never heard anyone say "from Washington" who didn't mean the state.
esprehn··on Google Is Deprecating the Widevine DRM CDM
WideVine stuff is probably marked private in Monorail (or maybe not filed there at all).
esprehn··on Web 3.0 – The Great Con
I think you're saying the same thing. The things you list are "criminal activities" because they "circumvent regulations".
esprehn··on Announcing KataOS and Sparrow
Fwiw that was 12 years ago, and a lot of the Google infra has changed quite a bit since then to make looking at user data much harder and track access more explicitly.
esprehn··on WebKit Quirks.cpp
It's not just about being the default browser, they're the only browser with no user choice to switch or manually upgrade or downgrade independent of the OS.
esprehn··on The 4th Year of SerenityOS
You missed GML, the compile time markup language for the UI:

https://man.serenityos.org/man5/GML-Introduction.html

Ex.

https://github.com/SerenityOS/serenity/blob/master/Userland/...

In general the scope creep is because Kling and co are all about fun and code beauty. And to their credit, the code is beautiful. :)

esprehn··on Dutch employee fired by U.S. firm for shutting off webcam awarded €75K in court
"Right to work" is a different concept related to unions, and includes Texas:

https://en.m.wikipedia.org/wiki/Right-to-work_law

All the states are At Will, but a number of them have exceptions that provide certain protections (ex. Not being fired for following the law):

https://en.m.wikipedia.org/wiki/At-will_employment

esprehn··on OpenStreepMap 2012 vs. 2022
There appears to be a bug in the 2022 map where it doesn't load tiles during a pan gesture so you can get stuck in an all white zone until you lift your finger off the screen:

https://user-images.githubusercontent.com/415779/193375980-7...

esprehn··on Go Micro: a standard library for distributed systems development
My experience is that tools like this don't scale in most organizations of even moderate size. Soon folks will want to write services in deno or ruby and the go first approach won't work anymore. Now you have "misbehaving" services connected to the system that may not implement load balancing or back off properly.

I've also seen it cause a lot of pain during upgrades since upgrading the service framework is implicitly upgrading so many other components and the framework is probably not being diligent about only improving one component (ex. Auth) per release. Sometimes that leads to basically never upgrading to avoid the risk.

It's true you need to do propagation for tracing but open telemetry has pretty broad support these days. That cost seems worth the stability and control.

esprehn··on Go Micro: a standard library for distributed systems development
Many similar projects are listed here: https://github.com/go-kit/kit#related-projects

go-micro seems like it does a bit too much, like service discovery and balancing within the framework when that's likely better handled by an Envoy/Istio.

esprehn··on Google is shutting down Stadia
If it make you feel any better, they eliminated exit interviews a few years back.
esprehn··on Named element IDs can be referenced as JavaScript globals
Yup that's what it did, and Chrome still does. After much research and prototyping the CSS JIT didn't improve real world content (especially given the complexity) so it was never added to Chrome.
esprehn··on Named element IDs can be referenced as JavaScript globals
On what hardware?

Also there's a performance cliff when you have a lot of unique ids (or selectors in use from JS).

When you hit the cache querySelector is primarily a getElementById call and then some overhead to match the selector a second time (which chrome should really optimize):

https://source.chromium.org/chromium/chromium/src/+/main:thi...

But if you have more than 256 selectors and ids in use:

https://source.chromium.org/chromium/chromium/src/+/main:thi...

You'll start to hit the selector parser a lot more and then querySelector will be a fair bit slower going through the CSS parser.

esprehn··on Named element IDs can be referenced as JavaScript globals
The global scope polluter has pretty bad performance and interop surprises, you shouldn't depend on it and instead use getElementById even if it's a bit more verbose.

It uses a property interceptor which is fairly slow in v8:

https://source.chromium.org/chromium/chromium/src/+/main:out...

to call this mess of security checks:

https://source.chromium.org/chromium/chromium/src/+/main:thi...

which has this interop surprise:

https://source.chromium.org/chromium/chromium/src/+/main:thi...

which in the end scans the document one element at a time looking for a match here:

https://source.chromium.org/chromium/chromium/src/+/main:thi...

In contrast getElementById is just a HashMap lookup, only does scanning if there's duplicates for that id, and never surprisingly returns a list!

esprehn··on Named element IDs can be referenced as JavaScript globals
Yeah, HTML5 explicitly documented the compatible behaviors between browsers to reach uniformity, which meant standardizing a lot of weird stuff instead of trying to fix it.

See for example this thread where Mozilla tried to not do this: https://bugzilla.mozilla.org/show_bug.cgi?id=622491

esprehn··on Named element IDs can be referenced as JavaScript globals
That's not magic, it's just how property getter and setters work on the global:

    <script>
        var _value = "test value";
        Object.defineProperty(window, "testName", {
            get: () => _value,
            set: (value) => { _value = String(value) },
        });
    </script>
    <script>
        var testName = {};
        // prints [object Object] string
        console.log(testName, typeof testName);
        var name = {};
        // prints [object Object] string
        console.log(name, typeof name);
    </script>
the `var` doesn't create a new property since the getter and setter already exist.

Other properties have the same behavior, for example `status`.

Note: there's also LegacyUnforgeable which has similar behavior: https://webidl.spec.whatwg.org/#LegacyUnforgeable

Even if you're not using modules, using an IIFE avoids all this by making your variables local instead of having them define/update properties on the global.

← PreviousPage 11 of 18Next →