Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
kiitos
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
39 ms
·
691.
▲
by
kiitos
3y ago
Unfortunately not. func main() { c := color.Red cptr := (*string)(&c) *cptr = "orange" PrintColor(c) // successfully compiles, and prints "orange" }
692.
▲
by
kiitos
3y ago
Bet you didn't do canary or blue/green deploys, or deliver automated telemetry data, or guarantee resource quotas, or provide network attached storage, or etc. etc.
693.
▲
by
kiitos
3y ago
What? Go is all about mechanical sympathy, and is absolutely a high performance language. I guess it all depends on your context, though. If you're used to writing assembly or C, things may look different. (A "for" loop expre
694.
▲
by
kiitos
3y ago
As jerf says, not really easily, no. But code review is a perfectly reasonable mechanism for catching this kind of thing.
695.
▲
by
kiitos
3y ago
Eh, I can't agree. I'm sure there is useful signal in there, but the author has a highly idiosyncratic view of the language, recommends tons of "optimizations" based on benchmarks that often aren't sound, and has s
696.
▲
by
kiitos
3y ago
func doSomethingSomeWay() *SomeError { Yeah, you'd never return a concrete error like this -- clear red flag in any code review. For precisely the reason you're demonstrating here! (Among several others.)
697.
▲
by
kiitos
3y ago
If this is the case, then flag evaluation can't possibly be part of any kind of hot loop, right?
698.
▲
by
kiitos
3y ago
> For example it wasn't clear to me that append() mostly doesn't copy the full vector, but does a copy of the slice pointer. Well I guess you do have to grok the language spec and semantics in order to understand how builtins l
699.
▲
by
kiitos
3y ago
> Are flags evaluated in-memory, locally? (Hopefully!) This seems like a MUST rather than a SHOULD, right?
700.
▲
by
kiitos
3y ago
if display := data["Display"]; display == nil || reflect.ValueOf(display).IsNil() { <code> I mean, even ignoring all of the interface{} design errors, the simple fix here is just if _, ok := data[&quo
701.
▲
by
kiitos
3y ago
A CRDT is a discrete entity/object that has to follow a set of rules for reads, writes, and storage -- including, but not limited to, rules about how to maintain history. You can certainly mix-and-match CRDTs with other entities in the
702.
▲
by
kiitos
3y ago
It's fine that you judge it that way, but it's not like that judgment is any kind of objective truth. I find it superior to the FP version because it is less ambiguous.
703.
▲
by
kiitos
3y ago
Applications should basically never need to write custom Scanner/Valuer functions that deal in interface{}, if you find yourself doing that it's a red flag
704.
▲
by
kiitos
3y ago
I see it as unambiguously more clear, because it makes explicit what the machine will be doing when executing the code. Whether map/filter copy values, or mutate in-place, or etc. etc. is non-obvious. I mean I'm not saying my wa
705.
▲
by
kiitos
3y ago
data := map[string]interface{}{} So this is the problem, basically. Go isn't a dynamically typed language, and doesn't really let you create an arbitrary map of keys to objects like e.g. Javascript or Python does. Any ti
706.
▲
by
kiitos
3y ago
> What's the go equivalent to x.map(fn).filter(predicate) Probably something like var output []T for _, val := range input { if newval := transform(val); allow(newval) { output = append(output, newval)
707.
▲
by
kiitos
3y ago
Yes, it's a not-uncommon gotcha or foot-gun. No argument there. But, like many other gotchas and foot-guns, they are not too difficult to spot in code review.
708.
▲
by
kiitos
3y ago
You're moving the goal posts. The claim isn't that Ken Thompson or whoever is flawless. The claim is that he isn't stupid.
709.
▲
by
kiitos
3y ago
That article is so cringeworthy
710.
▲
by
kiitos
3y ago
Nice joke.
711.
▲
by
kiitos
3y ago
> I see absolutely no evidence that the Go developers were particularly aware of theory Rob Pike and Ken Thompson are theory-unaware. Sure. Yes. This position is good and defensible.
712.
▲
by
kiitos
3y ago
Go definitely implements monotonic clocks correctly? https://pkg.go.dev/time#hdr-Monotonic_Clocks
713.
▲
by
kiitos
3y ago
This is a great example of code that compiles, but would never pass code review at any decent organization. Specifically, you'd never assign a concrete return value like *bar to an interface{} and expect `x != nil` to behave like this
714.
▲
by
kiitos
3y ago
Go offers a programming interface at a lower level of abstraction than languages like Python or Ruby. What you call boilerplate or housekeeping, I consider to be mechanical sympathy. Modulo extremes like Java, the bottleneck for programmers
715.
▲
by
kiitos
3y ago
interface{} is a pretty strong code smell.
716.
▲
by
kiitos
3y ago
> But I simply never see any discussion or usage of the low-level queue features offered by the language... Assuming we're talking about something that serves requests over the network, it rarely makes sense to define or use queues
717.
▲
by
kiitos
3y ago
There have been so many incidents in crypto that exploited broken assumptions about hash collisions. Factually, X != hash(X). Sometimes you can make the simplifying assumption that X == hash(X), but only in well-defined contexts, subject
718.
▲
by
kiitos
3y ago
I don't think it's a small gripe, IMO it's a critical UX issue! ULIDs don't have this problem, for the record.
719.
▲
by
kiitos
3y ago
For sure yes! There are tons of situations where you need to use the string form of an ID, e.g. filenames, and you definitely want the lexical ordering of files in a directory to be correct.
720.
▲
by
kiitos
3y ago
cuid [0] seems to be a random letter, concatenated with a sha3 hash of: - the system time - a process-global singleton counter (incrementing with each ID) - a "salt" derived from some number of bytes taken from an entropy source -
More ›