HNHacker News
TopNewBestAskShowJobs

goodoldneon

918 karma · joined July 23, 2018

submissionscomments
goodoldneon··on OpenD, a D language fork that is open to your contributions
Which languages do you enjoy more?
goodoldneon··on Python errors as values: Comparing useful patterns from Rust and Go
It makes the happy path harder to read but the unhappy paths much clearer. I hated this aspect of Go when I first started with the language but I love it now
goodoldneon··on Python errors as values: Comparing useful patterns from Rust and Go
Oh I agree, I've run into too many nil pointer panics. I wish Go had a first-class way of expressing optionality, rather than using pointers
goodoldneon··on Python errors as values: Comparing useful patterns from Rust and Go
Go can be `tuple[User | None, Exception | None]` or `tuple[User, Exception | None]`, depending on whether you're returning a pointer. But yea, Go's approach has its warts. Like if you aren't returning a pointer then you need to return the zero value (e.g. `User{}`) even when returning an error
goodoldneon··on Python errors as values: Comparing useful patterns from Rust and Go
Author here!

We don't return errors in our public methods so our SDK still feels Pythonic. We're debating whether to add `_safe` suffix methods that return errors to give people the option, but for now our library only throws errors to consumers.

You might ask "well what's the point if you still throw errors to consumers?" We feel that forcing our engineers to deal with errors where they can happen is worthwhile. Our team writes a lot of Go and we love how it forces you to think about every spot that can error, so we wanted the same experience in Python

goodoldneon··on Python errors as values: Comparing useful patterns from Rust and Go
That type won't help if you're unpacking like `user, err = get_user(user_id)`. Both values will be nullable and the type-checker won't understand that `user` is not None if `err` is None
goodoldneon··on Python errors as values: Comparing useful patterns from Rust and Go
By "context" I mean other data that lived at the time of the error. For example, you may want to update a table row when there's an error but if a thrown error takes you too far down the stack then you might not know the row ID anymore
goodoldneon··on Python errors as values: Comparing useful patterns from Rust and Go
> Exceptions are just spooky GOTO and a distance

I couldn't agree more! When you throw exceptions it's unclear where the control flow will go

goodoldneon··on Python errors as values: Comparing useful patterns from Rust and Go
Oops! I'll make that correction later today. You're right: they're mutually exclusive
goodoldneon··on Python errors as values: Comparing useful patterns from Rust and Go
> What if the program receives an interrupt signal during the get_user call?

You shouldn't catch interrupt signals regardless of whether you're throwing or returning errors. This is why your error classes should extend Exception and not BaseException. The interrupt errors (e.g. KeyboardInterrupt) extend BaseException

goodoldneon··on Python errors as values: Comparing useful patterns from Rust and Go
Author here!

> Why does the author want to swallow these exceptions?

Sometimes you want to swallow exceptions and sometimes you don't. The examples in the article may be a little contrived, but there are situations where logging an error and continuing is better because it prevents data loss.

> Let them propagate and it's obvious where the issue lies.

If they propagate down the stack then you lose context. You also may not have all the data you need to properly recover (e.g. still write to a table but make the errored field null).

> You still don't know what type of errors a function will throw without inspecting the code and thus how to resolve them.

You're right that we don't know which error occurred with the approach in the article, but you at least know that there could be an error. This is better than try/catch because that doesn't tell you whether an error could happen

goodoldneon··on Python errors as values: Comparing useful patterns from Rust and Go
We write wrappers for standard and third-party libraries that throw errors. For example, we have our own dump_json function that catches-and-returns errors thrown by json.dumps.

We didn't need many wrappers given the nature of our SDK, but some programs will need many wrappers and that could get unwieldy

goodoldneon··on Apple Plans Smaller, Lighter Vision Headset; Meta Works on Cheaper Quest 3
It doesn't need to be contact lens sized. There's a sizeable market for AR glasses, as long as their form factor is indistinguishable from regular glasses
goodoldneon··on Ray-Ban Meta Smart Glasses
Would be great while driving. Better than a dash cam
goodoldneon··on Reasons to replace advanced search with filters
How do you calculate the count for each filter without running a separate query for each filter?
goodoldneon··on Launch HN: Roundtable (YC S23) – Using AI to Simulate Surveys
"Simulate surveys" makes it sound like a satirical AI product
goodoldneon··on American universities have an incentive to seem extortionate
When reading your original comment, it sounds like you're saying that the solution is to avoid undergraduate college and leverage connections to immediately get a job. While that might work for people with those connections, how is that a solution for people without connections?
goodoldneon··on Ask HN: Anyone else notice that HN isn’t full of JavaScript frameworks lately?
How is it difficult? Tons of companies have profitable UIs that aren't using a meta framework. Just because the React team says "we recommend you do X" doesn't mean you have to do X. If they said, "you must do X" then yea, you should do X
goodoldneon··on Ask HN: Anyone else notice that HN isn’t full of JavaScript frameworks lately?
You can still use just React. No one is forcing you to use Next or Remix
goodoldneon··on Blocking Threads won't be enough to protect privacy once they join the Fediverse
Meta should use an event loop to avoid blocking Threads
goodoldneon··on Inngest raises $3M seed to build the reliable workflow platform for every dev
[Inngest engineer]

Half of us are Go devs, so we definitely don't think TypeScript should be the default language everyone uses. We only chose to start with a TypeScript SDK!

goodoldneon··on Inngest raises $3M seed to build the reliable workflow platform for every dev
> ... they find out how hard writing SDKs and tooling for each of them is.

Absolutely. Each additional SDK adds a lot of maintenance effort. It isn't just a write-it-once thing: - More time spent writing/updating docs - More context switching in support channels - More time spent updating SDKs as new features are developed

Staying focused on one SDK helps to keep velocity high in the early stages. But our product has matured enough that we feel comfortable gradually rolling out more language support, starting with Go soon

goodoldneon··on Inngest raises $3M seed to build the reliable workflow platform for every dev
Inngest engineer here!

We started with the TypeScript SDK to help us stay focused while we iterated and learned. As Tony said, we'll gradually expand to other languages (likely Python in the near future too!).

As for your "REST API instead of an SDK" concern, we invoke your functions so we need some code in your app. We need to handle things like memoizing steps within a function, so there needs to be some orchestration within the app

goodoldneon··on InfluxDB Cloud shuts down in Belgium; some weren't notified before data deletion
> ... if people can’t respond to vendors they pay money to, we’re really at a loss.

You're hurting your company's reputation by denigrating your customers like that

goodoldneon··on The ARM powered ThinkPad x13s, as a developer
I’d love the power of a desktop but I can’t leave my house with it
goodoldneon··on Oil Is Hard to Quit, Even in Norway Where Electric Cars Rule
Yes, because the price of oil would go up and there'd be more incentive to reduce oil consumption
goodoldneon··on Show HN: Banger.show – Create colorful visuals for your songs in seconds
Yea! We got a sneak peak of this in the Inngest community server :)
goodoldneon··on I prefer trunk-based development
How would code review work if everyone is committing and pushing? The article must mean tiny, short-lived branches
goodoldneon··on Ask HN: Stock Android phone free of bloatware?
I’m in the Apple walled garden and it’s nice. It’s expensive, but it’s nice
goodoldneon··on Meta developer tools: Working at scale
I used Phabricator at a previous (non-Meta) company. It was better than GitHub in some ways but worse in others. Overall I didn’t mind it
← PreviousPage 2 of 10Next →