HNHacker News
TopNewBestAskShowJobs

avolcano

3,882 karma · joined March 12, 2011

I write JavaScript and Python and other languages sometimes.

website: thomasboyt.com

submissionscomments
avolcano··on Swift AWS Lambda Runtime
This is a blog post I've been putting off writing for a while; I'll try to tl;dr it best I can given it's somewhat off-topic:

* TypeScript's lack of runtime types and stable reflection APIs make it hard to have any guarantees of type soundness without either code generation (e.g. schemats) or complex type programming to convert a runtime representation of a type to a static type (e.g. io-ts). I find this very frustrating when doing web backend programming, where you are constantly doing i/o with external services (whether HTTP APIs, or input from client requests, or database interaction).

This is particularly maddening because there's no de facto standards (seriously, there are a lot of these libraries: https://github.com/moltar/typescript-runtime-type-benchmarks), so it's not easy to e.g. find a DB library that will let you define an io-ts schema that a query should match without re-wrapping things yourself.

Basically: if TypeScript had runtime types, and an `as` cast threw an exception when a value doesn't match the specified type, I'd be much more inclined to keep using it. I genuinely think that's table stakes for a type safe language.

(and lest you think this has to be how TS works given the nature of how it's compiled to vanilla JS, I suggest you take a peek at Sorbet, which knew this was necessary: https://sorbet.org/docs/runtime)

* The TS ecosystem is generally underwhelming. I don't think any HTTP framework for it is particularly good, nor any ORM/query builder. I think there are a lot of really neat experiments still happening in this space, and it seems like every day GitHub's little "explore repositories" sidebar shows me another cool library someone's built for TS trying to solve some of these problems, but it's all early stage stuff with a bus factor of 1 and a long todo list.

To be fair, _Kotlin's_ ecosystem actually has a lot of these problems; the semi-official Jetbrains-maintained Kotlin web framework and DB access library both have a ton of untriaged issues and seemingly little production use. The good news is, at least on the server, you can completely ignore the "Kotlin" ecosystem in favor of the Java ecosystem, and this is _shockingly_ effective. Just about every JVM framework I've seen has some kind of officially-maintained Kotlin adapter, presumedly because it's not hard to sell Java developers on "what if you could keep using the exact same tools with a nicer language." These adapters aren't even needed, mind you, they just provide nicer APIs that can use Kotlin language features. Javalin + JDBI is infinitely nicer out of the box than trying to turn Express and Knex into a production-ready API with anything approaching type safety.

* This isn't a make-or-break thing, but Kotlin is just generally _nicer_ than JS or TS in a lot of ways, while still having a very similar programming style. For example, the collection types are far more robust than something like Lodash (let alone the absolute joke that is the ES6 Map/Set API).

avolcano··on Swift AWS Lambda Runtime
Is there any recent rundown on the state of server-side Swift in general? I know there was a lot of discussion when IBM stopped working on it back in January.

At the broadest level, I wonder what the footprint of Swift at runtime is, both in terms of CPU and RAM. I've been really enjoying Kotlin as a server-side language - it's a massive step up in productivity from TypeScript - but the overhead of the JVM certainly is notable, even in small personal projects (my small Javalin app uses four times the RAM at rest as my Express app did). Swift is really interesting to me because it is very similar in practice to Kotlin, but with some very cool and powerful additional language features. So, if server-side Swift has a smaller footprint at runtime and equal or better performance than Kotlin on the JVM[1], that'd be a really compelling language for me.

[1] yes, I know GraalVM/native options exist for Kotlin, but every time I've tried to investigate ecosystem compatibility, it leads to me glancing at pages long-articles about "how to configure X framework for GraalVM" that make it not seem worth the effort yet

avolcano··on [dead]
note to mods: I know there is an existing article on the front page about Trump's reaction to the fact check, but I think the specific target of Twitter's head of site integrity is a significant development worthy of a new post, instead of this being considered a dupe!
avolcano··on Nitrome to convert its Flash game library to HTML5
I built a tiny, kinda crappy multiplayer web game a few years ago (https://manygolf.club/), and while it's mostly dead now, it was relatively popular with 5-15 active players at any time for a few months (I know, small potatoes, but as someone who had never made a game played by _anyone_ outside of friends and family before, it was cool to see).

I noticed one of my biggest traffic referrers appeared to be from some kind of school proxy, and the most common Google suggestion for "manygolf" was "manygolf unblocked", so I imagine it is a lot of bored kids with locked-down devices. I also still get an occasional email every now and then from a "game portal" site that wants to license my game in some way, so I guess that stuff is still a market unto itself.

avolcano··on Show HN: A WebGL Tribute to Tron, the movie that made me fall in love with CGI
This is fantastic! Is it open source, by any chance? I'd love to see how you implemented the scanline filters and particle effects.

I've been juuust dipping my toe into 3D games with a little spline generator I'm hoping to make a game with (https://disco.zone/splines/3/), and as a fellow Tron fan, I'm very inspired by what you were able to do aesthetically here!

avolcano··on What Unity Is Getting Wrong
Curious - is your team using GDScript, C#, or C++ primarily? It seems like GDScript is still the happy path for compatibility, but I have mixed feelings about it as a language (though I've written enough Python to be relatively productive in it in my little Godot experiments).
avolcano··on Notion for everyone
This is kinda weird, because I was happily giving them $4/month after running out of space in their trial plan, and now I absolutely have no reason to keep giving them money.

Which, sure, I guess I'll take it. My $4/month isn't going to make or break their business and they probably barely give a shit about getting money for personal usage. Does remind me that my usage of their app doesn't align with their business model, which makes it feel rather... tenuous? Like at any time they might say "actually we're going to only support paid enterprise usage now" or "oh we're shutting down because companies just used Confluence and Airtable instead" (I have yet to sell any employer on using Notion because it's too unstructured for them to grok the benefits of :\).

avolcano··on Microsoft Fluid Framework Preview
FWIW, their docs[1] mention it should work on desktop Safari and Firefox, they just haven't built a mobile UI yet I Guess.

[1] https://support.microsoft.com/en-us/office/get-started-with-...

avolcano··on Microsoft is bringing Linux GUI apps to Windows 10
I'm personally quite excited about this. Been experimenting with WSL2 on my desktop lately, trying to figure out if I could port over my existing dev workflow from Mac. One stumbling block I had was that I've been writing servers in Kotlin lately, using IntellIJ, which is more or less the only game in town for writing Kotlin.

I wanted to run my app (and tests) in WSL, so I could closer-match my production Linux environments (and continue using all the bash scripts and ad-hoc CLI calls I had in my project), but if I wanted to run in IntelliJ on Windows, this would be tricky: IntelliJ doesn't support the WSL2 virtual file system, so I couldn't leave my files "in Linux," which means I'd have to run my server using the mounted C:\ drive in WSL, which is much slower. More importantly, I'd have to duplicate all my dependencies between Windows and Linux just to get the IDE working correctly, and couldn't e.g. use the IntellIJ test runner to run tests under Linux.

So... I just grabbed an X Server[1], installed XFCE in Ubuntu, installed IntelliJ, and then just started running it through that. And it works flawlessly as an app! I use the floating window mode in X410 so it just looks like any other Windows app (I mean, it's already a Java desktop app, so it's not exactly platform-native to begin with).

The only issues I had were clearly just with the X Server integration: sometimes, when I had other windows open over IntellIJ, tooltips would still start showing up in IntelliJ from whatever was underneath my mouse, sometimes right click menus just mysteriously stopped working until I restarted the server, etc. The latter was particularly annoying since you can't restart the server without restarting the app, but was infrequent enough I was okay living with it.

That said: I am hopeful that this new Windows integration will perform better and with fewer bugs than the X server implementations out there right now. The fact that it will support GPU integration makes me think it must be doing more than just a traditional X server - in fact, doesn't that require Wayland? Curious how this is implemented under the hood.

[1] I'm using https://x410.dev/ but there's a decent amount of options. This one is paid, but at least is on sale right now.

avolcano··on WorldBrain's Memex: Bookmarking for the power users of the web
The site is weirdly ambiguous about this but: I am assuming by "offline-first" they mean that the "full-text history capture" never leaves my device, right? Or does it get synced optionally? Or only synced to other devices I have?

It's baffling to me that they put "privacy-centric" front and center and then do not in any way explain what that actually means.

avolcano··on OpenBSD on the Microsoft Surface Go 2
The problems with the Go 2 that I've seen in reviews are:

* The base model has a woefully underpowered Pentium CPU

* The upgrade model has a more reasonable but still not great m3 that seems like it'd be a tad too underpowered for dev work, unfortunately - maybe this is my fault for being an IntelliJ user, though.

* The keyboard/trackpad cover is a separate purchase, and while it's not the eye-watering $350 that the newest iPad Pro keyboard/trackpad is, it's still an extra $100 or so.

* The keyboard/trackpad cover is a bit wobbly and too small to be comfortable for extended use.

The biggest issue is that the Go 2's upgrade version + keyboard cover is a total of around $720, which is the same cost as a lot of solid entry-level Windows laptops that have much more powerful processors.

Pricing is a constant problem with Surface hardware across the board, so this isn't that surprising, but was disappointing to me - the Pentium version sounds underpowered to the point of uselessness, but the upgrade variant is too expensive to justify as anything but my primary computer and far too underpowered for that.

Here's The Verge with more: https://www.theverge.com/21259805/microsoft-surface-go-2-rev...

That said I know there have already been some small sales during the Go 2 launch (e.g. Best Buy took $25 off the cover), so I'm kind of hopeful that within the next six months it'll somehow dip below $600 or so.

avolcano··on uBlock Origin on Firefox Preview
Context is interesting here: uBlock Origin is one of the few extensions available in "Firefox Preview," the new Firefox app for Android. The app is somewhat controversial for breaking existing extensions, but they have been slowly adding some whitelisted extensions, with uBlock having been the first announced.

I hope Mozilla is able to roll out full extension support sooner rather than later in FF Preview, but I do appreciate that they take it seriously enough to work with developers this closely.

avolcano··on A first look at Unreal Engine 5
Well, it's worth noting Unity doesn't have royalties - you just pay per seat on a monthly cost, and it's free indefinitely* if you make/raise less than $100k a year.

* (this also means no official support and a few missing features, not sure if UE4 offers everything for free)

avolcano··on EnTT: Gaming meets Modern C++
Yeah, I suspect this is one of those things where when you Google it, people are mostly like "why would you ever need pooling in JS," but then it turns out pooling is used under the hood in a lot of game frameworks.

I know Ecsy[1] is using it, which makes sense because that's targeted at apps building for WebVR which really cannot afford GC pauses, so I guess it must have some merit.

I guess I could try monkey-patching immer to have it pull from a pool when creating new objects? Theoretically if it just used nominal typing (re: classes) to pick objects out of the pool and overwrite all the fields on it, as I assume it normally would do with a brand-new object, this could work out okay. Could just do pooling on the top-level component objects and deal with GC on any nested objects to simplify things (especially because nested objects probably wouldn't have classes associated with them).

[1] https://ecsy.io/docs/#/manual/Architecture?id=components-poo...

avolcano··on EnTT: Gaming meets Modern C++
I'm not actually sure requestAnimationFrame() in a browser ever gets you >60 fps. At that point, honestly, you'd probably need an independent render thread (doing some degree of interpolation) and stick to a 60fps logic tick. Which you can theoretically do in JS using web workers, though I know message-passing incurs some serious overhead in that case.
avolcano··on EnTT: Gaming meets Modern C++
I was looking at EnTT's API when building a little toy ECS of my own in JavaScript. Since I'm working in JS, I haven't really tried to copy its internal architecture since it doesn't quite make sense for a higher-level GC'd runtime, but I think the public API was a really handy reference for the kinds of things a practical ECS needs to have. It's a really impressive and robust project, and the documentation is super thorough and worth a peek if you have any interest in game architecture.

(slightly off-topic, but I'm excited to have a venue to ramble a bit about this:) ECS is really cool, and I'm excited about using it more for my games. The "cheap" (de)serialization by moving all state into pure, data-only components is really fascinating - I've been playing around with building networked multiplayer games for a while now, and I'm currently experimenting with rollback netcode.

A key part of rollback is saving your state every frame so you can load it if you need to roll back, and ECS makes saving/loading easier to reason about, since you can "just" grab the components and their associated entity IDs and load if needed (EnTT, for the record, has an API for this[1], though they leave the actual (de)serialization up to you). Of course, JS's lack of a memcpy equivalent makes this much harder than what you could do in C++, which has lead me to experiment with immer[2] in my ECS, which uses structural sharing to avoid mutation, so you can get a "copy" of your state by just keeping a reference to it, as future updates will make new objects. This, of course, theoretically could make a ton of garbage (e.g. updating your position every frame would create a new Position object every frame), which is not great for high performance games. I'm not sure how bad this will be in practice - JS GC is relatively smart and fast these days, but I haven't tried doing much beyond little pong or platformer demos yet. I'd also imagine that, like, doing a deep clone of my state tree every frame (or doing the whole JSON.stringify/parse dance if I stick to primitive values) probably generates just as much garbage. Maybe if I could integrate immer with some kind of object pool it'd avoid these issues, but I have no idea how useful object pooling is in practice in JS...

[1] https://github.com/skypjack/entt/wiki/Crash-Course:-entity-c... [2] https://github.com/immerjs/immer

avolcano··on Nuxt.js over Vue.js: when should you use it and why
Does extendRoutes (https://nuxtjs.org/api/configuration-router#extendroutes) not work for y'all? I haven't had to use it (yet) but I was happy to see an escape hatch, though I could imagine it not scaling very well...
avolcano··on Nuxt.js over Vue.js: when should you use it and why
I'm pretty happy with Nuxt. I built a project with a custom SSR server based on Vue's guide (https://ssr.vuejs.org/), and maintaining it/tweaking it wasn't too bad, but moving all that complexity to Nuxt was nice. If you'd like to see a realistic codebase, warts and all, it's here: https://github.com/thomasboyt/jam-buds/tree/master/app (powers the jambuds.club frontend).

They do have a kind of weird plugin/module system that I worry is an overly complicated layer of abstraction - basically, stuff that would normally be manually hooked up in your server or client entry point script now gets called automatically by Nuxt at various points. Still, it is useful for setting up things like authentication (e.g. parse cookies on server and set auth headers in Axios).

They're also still iterating on the public API, though they've been pretty careful to deprecate without breaking things. Like, the fetch() hook that used to be used to load data at a page level (e.g. "before transitioning to this route, load this set of data") was totally overhauled to now be "load data for this component," with no "pre-transition await" available anymore (https://nuxtjs.org/blog/understanding-how-fetch-works-in-nux...). This is a good change, but an example of the complex problems that come up in these SSR frameworks, and why they end up being a lot more complex than just simple wrappers around the ecosystem. You really have to buy in when you use a framework like this, more than just buying into Vue itself.

I did see that they just raised a seed round (https://nuxtjs.org/blog/seed-round), which is surprising to me. I don't see a lot in that announcement about how they're going to make money, which is a bit scary. Over in React-land, of course, Next.js is nominally owned by Vercel (formerly Zeit), which is also venture-backed, but Next is related to their primary revenue stream while not being at all the main focus of the company, which is probably the right spot for this sort of thing.

Moving to Vue 3 will be a problem for Nuxt, I think, because of the abstractions they've built on top of Vue.

(also, glad this post came up because while double-checking to see how big Nuxt is in my app, I realized I was failing to gzip my client assets because I misconfigured Caddy, gah!)

avolcano··on Will coronavirus break the sports media industry?
Fair question! Different folks get different things out of it. Personally, I got into it a few years ago since I have some friends who are into it. It drew me in with all the spectacle, and kept me in with how compelling the long-term storytelling can be.

Lots of people compare wrestling to soap operas, with the overdramatic acting and the constant, several-times-a-week frequency of shows, but really the closest comparison I'd have is something like the current Marvel movie franchise - a silly, bombastic thing that somehow winds up being surprisingly emotionally effective (at times). Of course, much like how there are a lot of bad superhero movies, there is a lot of bad wrestling, but the good stuff can be really good.

avolcano··on Will coronavirus break the sports media industry?
As probably one of the bigger wrestling fans on HN, I feel obliged to point out that WWE is doing very poorly even though it's just about the only live sport-like product left on TV: https://www.f4wonline.com/wwe-news/wwe-smackdown-falls-below...

WWE's TV deals are in danger, which is why they are terrified and trying to be the first thing back up and running, to grab as much marketshare as possible while they can. Doesn't seem like anyone's biting, though.

(the shows are also pretty unwatchable these days, but that was a problem long before coronavirus. that said, I agree with the other commentator that some of the pretape stuff they've been experimenting with has been working okay, and I'm kind of cautiously optimistic about the upcoming Money in the Bank PPV, which sounds like the film "The Raid" but with pro wrestling)

avolcano··on Show HN: Caddy 2
I liked v1 a whole lot. I'm interested in v2, though I'm extremely skeptical of the additional complexity of the config adapter layer (https://caddyserver.com/docs/config-adapters) - I'm more or less sold on having an internal JSON structure with a DSL on top of it (allowing dynamic/programatic config is really interesting), but the idea of having _multiple_ different DSLs or config syntax bindings for it seems a bit much.

The biggest feature in Caddy 2, from what I can tell, is the new HTTP config API, and I'd love to see a practical example of what could be done with that.

avolcano··on Backblaze B2 Cloud Storage Now Has S3 Compatible APIs
Huh, I thought it already had this! Must have mixed it up with a different object storage service (maybe DigitalOcean?).

I've been using B2 for backup storage for some personal projects. It doesn't necessarily do anything "better" than S3 from what I've seen, but never having to log into AWS's dashboard is a reward enough on its own.

They do have a command-line client that's a quick PIP install, so you can do something like:

  b2 upload-file bucket-name /path/to/file remote-filename
Which is, of course, nice for backups.
avolcano··on Why Restaurants Are So Fucked
You'll find a $16 doner in the comically overpriced food court in City Point, or a $15 currywurst at a place Chelsea Market.

This is, of course, a comically grim state of affairs compared to the 4 euro doner or currywurst you can get in Berlin. Though I will say NYC halal carts might be the best _common_ street food in the US, and that hasn't yet made it above the $6 sandwich/$7 plate mark... yet.

avolcano··on NPM Is Joining GitHub
Ah, neat! Works out well for them; I assume it's relatively cheap to just serve an S3 bucket on their CDN (though I guess bandwidth costs may rise rather dramatically if Rust ever reaches Node levels of popularity), while not taking on any other operational expenses of actually running a registry.
avolcano··on NPM Is Joining GitHub
Who's funding the S3 bill? Took a peek around crates.io but didn't see anything about it.
avolcano··on First US Covid-19 patient recovered just one day after Remdesivir antiviral
The Wikipedia article linked notes that previous trials for this drug against Ebola (which were not as successful as other treatments) had established a "safety profile." Hopefully that applies to its use here as well.
avolcano··on How to Find New Music
My extremely modern recommendation for those feeling like they have no good sources: have y'all tried reading more blogs?

I still read Stereogum (which recently went independent again after being owned by Billboard) and Pitchfork. I stay reasonably on top of popular music with them - Stereogum in particular strikes an amazing balance between having good coverage of straight-up pop while still giving coverage to often-ignored genres like hardcore and grime. Their writers certainly have their blindspots, and they are driven by popular label press releases as much honest discovery, but that's kind of why I read them - I want to stay on top of the zeitgeist.

I think if you have specific tastes, you should find sources covering your niches. I also think that if you live in a major city, you may want to find local coverage - I read Brooklyn Vegan, which is (unsurprisingly given the name) also mainly focused on mainstream indie, also but covers a lot of smaller artists who are coming through NYC soon. I've managed to see a lot of live music I never would have heard of thanks to them.

I am also interested in working on better ways to discover music. I've been working on a small Twitter-like social network for sharing new music on and off for the past few years, somewhat comparable to This Is My Jam. It doesn't do any fancy algorithms or anything, it just presents music your friends post in a form that's easy to listen back to (via Spotify and Apple Music SDKs - would love to have more sources someday, but Soundcloud and Bandcamp don't really have APIs for this, and obviously hosting content is a minefield). I'm watching the comments on this thread closely for inspiration on this - right now I've just been using it with a couple friends and thinking about how it might expand in the future :)

avolcano··on Tell HN: Mailgun lowers free-tier API from 10k to 625 emails per month
As someone who has a noncommercial side project and has been using SendGrid's free 100/day plan, I'm actually thinking of switching to this. I've always been a bit concerned with what would happen if my app got a sudden burst of signups (since email verification is required to sign up), and have been looking for an uncapped plan, but don't want to spend $10 a month or more just for that possibility.

The key here is that with the $0.80/1000 emails PAYG rate, you can still do like 2000-3000 a month for less than $5, which no one except SES will provide. Everyone else has a gulf between "free tier 100/day" (or even 100/month with Postmark) and their first actual paid tier ($10/month for Postmark, $15/month for SendGrid). No one else except SES has this PAYG for low rates as far as I'm aware. I think if your hobby project needs more than 625 emails a month, it's reasonable to spend a dollar or two on a month to handle that.

avolcano··on Vue RFC: Expose logic-related component options via function-based APIs instead
I've been following the Vue + TypeScript progress on and off for the past couple years (ever since I converted a React project to Vue and threw out TS in the process, since it was just so fundamentally incompatible with Vue's APIs). This is a pretty wild change compared to the now-abandoned class proposal, and I'm somewhat bummed by it, but I'll admit that's mostly due to my continued skepticism of hooks (as someone who hasn't yet adopted them in my React projects, either).

This will require one hell of a migration path to support and I imagine lots of people will be on that "Compatibility Build" for a long time. I'm very, very curious whether folks who have large-scale Vue apps have had a look at this proposal, and if they've had any input on it.

avolcano··on Show HN: PugSQL, a Python Port of HugSQL
I really like the idea of this! Potentially quite helpful for the GraphQL space, I think, since these query files could map 1:1 with resolvers (if I understand GraphQL correctly).

I've been working on a Node+TypeScript web app on and off for the last couple years, and one thing that's always bugged me with it is database access - it uses Knex.js as a query builder. Knex is a solid (if imperfect) DSL for interacting with SQL, but as time goes on and I get more comfortable with SQL, I've started wishing I could write raw SQL instead more easily. I think an architecture like PugSQL might help bridge the gap between "passing a bunch of SQL strings around" and a query builder.

Slightly off topic further thinking - one problem I've always had with Knex and TypeScript, though, is the lack of static typing - I've been writing runtime validations for each individual query result. This has been a bit annoying to maintain at scale since I don't have very good patterns for it. With a system like PugSQL, though, I could imagine just having input and output validators for each parameterized query.

Of course, the long term dream would be to generate type definitions from the SQL files, but I assume that would require a heck of a lot of magic (e.g. "actually run a query, figure out what the schema of the result table is, and create a snapshot of that"). I haven't seen a lot of prior art in terms of "static typing of DB access without a big ol' ORM," but I'm hopeful there's some options.

← PreviousPage 3 of 14Next →