HNHacker News
TopNewBestAskShowJobs

john567

126 karma · joined November 24, 2021

Software engineer working a lot with JavaScript, TypeScript, V8, database design, React, functional stuff with some low-level hackery on top.
submissionscomments
john567··on Why don't more languages offer flow typing?
You have to emit the plumbing for something like flow typing to work. You can't omit the type checking because you cannot account for all the possible call sites at compile time, that will lead to a combinatorial explosion. You do end up generating code to pass arguments with temporary type information.

Take the example of a variant type, which is what I'm most interested in.

You have something like type X = int32 | string | boolean | SomeCustomType

When you then write a function that accepts X as a type you need to be able to pass any of these things into that function. To do that you need a auto user defined type that can carry the information, in C that might look like this

struct { union { int a; char* b; boolean c; } data; Tag type, }

then your type assertions can work on this. If you wrote this in my fancy language:

if x != nil { // x cannot be nil here x.foo }

the equivalent C code for this would be something like

void f(X x) { if (x.type != WELL_KNOWN_NIL) { x.data.foo // we know it's safe to access foo (assuming we typed X as Foo | nil) } }

Trying to solve this at compile time without any runtime checks might be possible but I don't know that it would be better, it might be too slow if I have to solve some nasty combinatorial problems. This is at least somewhat easy to explain.

john567··on Why don't more languages offer flow typing?
I'm trying to design a programming language that can be compiled into C99 and it's not at all clear to me how you represent these things statically.

The idea from a programming point of view is really nice and in a dynamic programming language environment everything is an object and you can pass whatever through any function. This doesn't work all that well if you want to translate your program into a statically typed environment, in a cost effective way.

You need some way to reason about the type information that hopefully doesn't create memory allocations all over the place.

This can be done by introducing tagged data types but it can also lead to a combinatorial nightmare where you need to generate a lot of extra code.

In general, I don't think all this complexity is warranted in a statically typed environment and depending what you are doing this doesn't end up being that important. Even if, it's a nice to have, it's mostly that, a nice to have.

john567··on What are terahertz waves useful for?
This site should be banned. Tried to read stuff. Got 3 different floating dialogs, a consent screen and the some exit modal crap on top. Accidentally missclick and ended up somewhere else completely. Dear God, they are ruining the Internet and every website out there.
john567··on The Day George Soros Broke the Bank of England to Make $1.1B (2021)
Even if I leave my front door unlocked it's not your prerogative to empty my house. The locked door is there to suggest that it's a immensely stupid idea. I cannot begin to imagine the self entitled bull, someone peddles to themselves, to justify corruption and greed at this level.
john567··on Go 1.18
No you don't.

If you do, you haven't understood the problem that you need to solve and you are reaching for things you don't need to use.

john567··on Directly converting CO2 into a gasoline fuel (2017)
Elon Musk once pointed to the low energi state of CO2 as a problem meaning it doesn't react with other things without additional energy added. This makes carbon capture fundamentally hard and anyone claiming otherwise is either in possession of some infinite power supply or we live in a post scarcity society.

Either way, planting trees appears to be a good mechanism for carbon capture. So go do that instead!

john567··on Could cancer cells’ iron addiction be their Achilles heel?
It was never homophobic. It was because there was a prevalent HIV epidemic amount homosexual men predominantly which influenced policy and rightly so. They couldn't reliably test the blood and promise they wouldn't spread it so they opted for the lowest risk possible. It made a lot of sense.

Maybe things look different today but those are some pretty good reasons for why it is the way it is today.

john567··on Go’s major versioning sucks – From a fanboy
Don't make breaking changes. Make new APIs then transition users. Remove old APIs as needed when usage is very low.

Niche people that depend on the old API will stick to an older version and be happy with that.

john567··on IQ test for SW Eng interview?
It's just a test. As far as I know IQ science, is good science. It does measure something real.

Engineering does require a decent IQ, if you don't have that, you're unlikely to thrive as an engineer.

Unlikely doesn't mean you can't.

john567··on Obscure HTML Tags
FYI do. not. use. the dialog tag. It may work but it has a host of other issues. I don't even know if it's an accessibility benefit for anyone but it behaves in weird and uncontrollable ways.

Just make a dialog with a div like you've always have been.

john567··on Google Tag Manager, the new anti-adblock weapon (2020)
So, where I work. I actually manage our Google Tag Manager infrastructure. Our marketing department make change requests that we review and implement. They do not get to do whatever they want. We actually consider it to be a backdoor.

It's a useful tool but it should be managed by the people building the product and we have to clean up and remove tracking code when it has served it's purpose.

john567··on Current hardware trends make C++ exceptions harder to justify
Why do we need to have ambient control flow? This is what exception handling is, it's a hidden control flow.

I don't use them. I just create an error type and pass that around.

The only legitimate exception I will accept is when you access invalid memory. That's a special case and depending on the environment something extraordinary must happen.

But exceptions and exception handling just creates annoying code. It doesn't add value, not really.

john567··on HTTP/3: Everything you need to know about the next-generation web protocol
Looks like WebTransport has been designed to do what I want to do.
john567··on HTTP/3: Everything you need to know about the next-generation web protocol
Ok, so streaming might be an option. In this case I'm not limited to browsers. Just curious if it might be applicable elsewhere.
john567··on If you’re so smart, why aren’t you happy?
Being happy is the wrong goal.

What is intelligence anyway? We don't know. Not really. We have an idea of what we associate with intelligent behavior but we don't really have a good theory of intelligence that we can use to create intelligence.

The reason I think happiness is the wrong goal is because it's a by product of the right goal. Not the goal itself. That which fulfills you should reward you with a feeling of happiness.

For example, my children give me happiness when they get to roam and be children. But when I must discipline my kids they get sad and I get sad. There's an error here in my parenting that I'm trying to minimize. It's difficult but it requires me to not take it on myself to shoulder their burdens. They have to work through most of their issues on their own and I cannot protect them from the world. Trying to shield them from it will probably make everyone unhappy.

My work makes me feel important but it doesn't make me feel happy. Having a good working relationship with my co-workers rewards me with happiness and meaning.

I don't aim for happiness but I'm quite happy. Not all the time but when I care about the right things I do feel genuinely happy.

john567··on HTTP/3: Everything you need to know about the next-generation web protocol
I'm interested in using HTTP/3 for bi-directional communication.

Anyone with more experience on this care to weigh in?

I know there's WebSockets but that's typically implemented over HTTP/1.1 with durable TCP connections.

Let's say I wanted to do near real time (lowest possible latency preferably) synchronization in a server/client architecture, can HTTP/3 make sense here?

john567··on A woman who can descend into the sea on one breath
There's nothing wrong about writing about women doing stuff. It's the way they do it that's annoying. Write a good article. Don't bend the truth. Be honest! What she is doing is still impressive.
john567··on Why do Americans have to pay much to file their tax returns when the IRS knows?
Different districts in Sweden have different rates but that's it.

I was mostly upset by them asking for a fee if you do taxes digitally. That should make it easier for them.

john567··on Valve’s Steam Deck wows reviewers: ‘The most innovative gaming PC in 20 years’
I find that a lot of laptops have underpowered GPUs and I like to game. Also, there's the repairability aspect. I've been interested in the framework laptop but I'd prefer an AMD SoC with some gaming capabilities.

Also, I'm not giving my money to Intel for the foreseeable future.

john567··on Valve’s Steam Deck wows reviewers: ‘The most innovative gaming PC in 20 years’
I find that a lot of laptops have underpowered GPUs and I like to game. Also, there's the repairability aspect. I've been interested in the framework laptop but I'd prefer an AMD SoC with some gaming capabilities.

Also, I'm not giving my money to Intel for the foreseeable future.

john567··on Valve’s Steam Deck wows reviewers: ‘The most innovative gaming PC in 20 years’
Any decent steam machine could do but I haven't seen many small machines that I'd want to buy.
john567··on Valve’s Steam Deck wows reviewers: ‘The most innovative gaming PC in 20 years’
I'm considering using a SteamDeck as a portable workstation. It's no powerhouse but you'd be able to get a lot of stuff done on something like that. I'd connect it to a keyboard, mouse and external monitor. I've been thinking about not using Windows as my primary platform and Valve has put together something I think I could really get behind.
john567··on Why do Americans have to pay much to file their tax returns when the IRS knows?
How the fuck can there be a fee for "e-file" it should be the opposite if anything.

I live in Sweden. Yeah, that country. Not only do we have a bank issued digital identity our revenue service has a online system for doing your taxes and it takes less than 10 minutes.

If you buy/sell stocks using ISK and have a mortgage all of that is manage for you. You just review the numbers and sign of on it (using your digital identity). Then you get your returns.

The US tax system is perplexing to me.

john567··on ReScript aims to be a strictly typed JS, simpler and faster than TS
I find it very confusing why they don't embrace the JavaScript echo system. I'm all for a new syntax that does away with some of the bad parts but if you can't async/await, well then you can't really do I/O, and if you can't do that then your app isn't particular fun to use.

That said, I get that there's callbacks for everything and that you can do I/O with callbacks but it's not fun and if that is your only option you're going to need some external Flux "store" to manage all your state.

Edit: I should also add that I understand that there are people who find the async/await paradigm to be bad but I don't think we have much of an alternative when it comes to JavaScript or if you want an alternative, we'll then you are hardcore enough to be fine with just callbacks.

john567··on ReScript aims to be a strictly typed JS, simpler and faster than TS
Oh. Shiny!

Wait! This is not new. This is Ocaml disguised as JavaScript... It is based of BuckleScript and Reason.

Stuff I've considered in the past. Note sure if I will ever use it but okay. Interesting...

john567··on An introduction to type programming in TypeScript
Ha. It's not you. It's a shit show everything is a afterthought. It's incredibly inconsistent and clunky all over. I just don't try to get carried away with typing stuff too smartly.

Most of this is just the way the language evolved, along JavaScript. I wish they'd abandon the "JavaScript superset idea" and cleaned up the language.

Make the common case simpler and more straightforward, drop everything exotic, it's not practical nor strictly necessary.

john567··on Tesla to recall vehicles that may disobey stop signs
I don't think that's correct.

Having the ability to reason about what you see can be helpful but it's not necessary.

Whatever the most developed version of the Tesla FSD software is, it already recognizes that people (children) can hide behind objects.

If you look at the way the FSD development is made you'd notice that they changed from coding to designing AI around a particular task. This is something they started doing quite recently.

Inferring speed limits from sign data is one problem but you could extend this to classify driving conditions based on image data from all cameras. Trying to detect a reasonable speed limit based on that, forgoing sign detection entirely. Sure, the car can get it wrong but if you err on the side of caution (which you do) the car will pick the slowest option based on conditions and you won't care because you aren't driving anyway.

As horrible as this may sound, ultimate, the system will prove itself when it is involved in fewer accidents and at that point it is a benefit to all. If this doesn't happen then Tesla is wrong but it sure looks to me like they are moving along this path nicely.

Driving a car is a simple problem. At least compared to something like general intelligence. You only need to know if it is safe to drive in a particular direction and sure this is a complex problem as you go into the details but it isn't general intelligence hard. We don't even know what intelligence is but we do have something that is looking a lot like cars that can drive themselves.

I'm a believer.

john567··on mmWave radar, you won't see it coming
My reaction as well. Given how many ways there are to uniquely identify individuals this isn't a selling point for the tech. It's just a different kind of camera and of course it can identify people it's just that it will not reproduce a picture of people's faces to do so.
john567··on A pipe operator for JavaScript: introduction and use cases
I lost it over conditial assignment. That is absolutely something I have no intention of using ever.

Also, JavaScript has some rather quirky behavior. I'd rather see a stricter JavaScript without the quirky stuff take it's place.

FYI, symbols are incredibly useful!

john567··on The Internals of PostgreSQL
I think it's important to write your own parser, at some point. Though, for the purpose of learning you need someone to guide you.

If you're learning this stuff you need a simple challenge to work through the end.

With regards to lex and yacc, I absolut detest these tools. They are horrible but they do work. And if you just want a functioning parser they'll do. My main criticism of these tools are the horrible errors you might end up with and the lack of sensible extension points.

If it is your first foray into parsers, I do think a simple grammar and handwritten lexer/parser is a good first step. Iterate some on that, then use tools to help with the verbose stuff.

Though to be honest, I enjoy writing parsers by hand. So, I'm a bit biased.

← PreviousPage 3 of 4Next →