HackerTrans
TopNewTrendsCommentsPastAskShowJobs

can3p

no profile record

comments

can3p
·2개월 전·discuss
All the usual suspects, error handling, sum types, interfaces.

Just a note, I'm yet to see a problem highlighted in the section about interfaces, in particular that changing a concrete type will make it not fit the interface anymore which will result in troubles. It's often used as a tool to make the changes (e.g. change the interface, observe the compilation failure and fix all the occurrences). They way interfaces are usually defined on site as a minimal possible signature - if your code just needs one method, you define a narrow interface and that's it. That also makes it impossible to predict what kind of interface is needed at producer side.

If the argument is that you can fit a wrong struct into the interface, then again, I'm yet to see a real life manifestation of this problem.
can3p
·4개월 전·discuss
Every library is a liability especially in terms of api. There are many example where the first take on a problem within a std lib was a bad choice and required a major overhaul. Once something is in standard library it’s literally impossible to take it back without breaking the world if you don’t control api consumers
can3p
·4개월 전·discuss
I think this post needs better examples to show case the issue, because right now the issue is not clear. Ideally you would need an example that uses the context.Cause function, see below

The contexts and errors communicate information in different directions. Errors let upstream function know what happened within the call, context lets downstream functions know what happened elsewhere in the system. As a consequence there isn't much point to cancel the context and return the error right away if there isn't anybody else listening to it.

Also, context can be chained by definition. If you need to be able to cancel the context with a cause or cancel it with a timeout, you can just make two context and use them.

Example that shows the approach as well as the specific issue raised by the post: https://go.dev/play/p/rpmqWJFQE05

Thanks for the post though! Made me think about contexts usage more
can3p
·7개월 전·discuss
> For many business apps, they will never reach 2 billion unique values per table, so this will be adequate for their entire life. I’ve also recommended always using bigint/int8 in other contexts.

I'm sure every dba has a war story that starts with similar decision in the past
can3p
·8개월 전·discuss
The other reason is the volume of the code being produced combined with the constant product changes. An innocent change like mixing two close but still different concepts can easily poison the whole codebase and take years to undo and may even be nearly impossible to fix if it propagates to external systems outside of direct control
can3p
·8개월 전·discuss
Reads like a straw man. Was "being simple" anywhere in rust lang agenda?
can3p
·3년 전·discuss
https://github.com/volatiletech/sqlboiler