#Rustlang expect vs #Python except

expect → "if this fails, crash."
except → "if this fails, I've got it."

Same letters. Different meanings.
0
0
0
23
#Python PEP 249 (peps.python.org/pep-0249/) and #Golang database/sql (pkg.go.dev/database/sql) show why DB standards matter: apps get one stable API across drivers. PEP 249 defines a shared set of exception types, so switching DBs preserves your basic error handling structure.
0
0
1
123
#Python (uv) ➔ #Golang:

• pyproject.toml deps ➔ go.mod require
• dev group: ruff, mypy ➔ go.mod tool
• dev group: pytest ➔ testify, go.mod require
• uv.lock ➔ // indirect + go.sum
• uv run <tool> ➔ go tool <tool>
• .venv/ ➔ vendor/ (opt-in; shared cache)
0
0
0
200
val, ok := m[key] // Maps
val, ok := <-ch // Channels
val, ok := i.(Type) // Assertions

val := m[key]
val := <-ch
val := i.(Type)

In #golang, the 2nd variable ok is completely optional. Use it when a ok is needed.
0
0
0
141
Lock() in sync.Mutex / sync.RWMutex vs RLock() in sync.RWMutex:
Lock() — blocks readers AND writers
RLock() — blocks writers only, does NOT block other readers

Use RWMutex RLock() when reads >> writes.
#golang #concurrency
2
0
0
131
Replying to @_r_sachdeva
Always benchmark, but for writer starvation: "pkg.go.dev/sync#RWMutex If any goroutine calls RWMutex.Lock while the lock is already held by one or more readers, concurrent calls to RWMutex.RLock will block until the writer has acquired (and released) the lock "
0
0
0
63
sync.Once's .Do and sync.OnceFunc both take func() — no return.
So the result has to live somewhere: a separate struct field you write to as a side effect.

sync.OnceValue takes func() T — the return value IS the cache. No extra field.

#golang #concurrency
0
0
0
86
time.After(d): Concurrency tool. Sets up a background timer and returns a channel.

t.After(u): Date/time method. Instant boolean comparison to check if timestamp t occurs after timestamp u.

#Golang time package
0
0
0
89
Go proverb: “errors are values” means “errors are values that implement the `error` interface.”

#Golang
0
0
1
59
Go's time package has two sides:
date/time handling
Timer-based concurrency tools:

time.NewTimer(d)
timer.Stop()
timer.Reset(d)
time.After(d)
time.AfterFunc(d, f)
time.NewTicker(d)
ticker.Stop()
time.Tick(d)

#golang #concurrency
0
0
0
93
Go goroutine stack dumps show a bracketed state like [chan send] or [chan receive]: that means blocked. The full list lives in src/runtime/runtime2.go as waitReason constants. Not documented anywhere else. #golang
github.com/golang/go/blob…
0
0
0
110
Check out the official list of Go replacements: pkg.go.dev/golang.org/x/t…
From Go 1.26+, `go fix` helps you with each of these replacements automatically! #golang
0
0
0
86
#golang
• for {} — Header omission = true.
• switch {} — Header omission = true (if/else chain).
#ziglang
• while (true) {} — Header requires explicit true.
• if / else — Standard conditionals; switch requires expression.
0
0
0
117
It’s great to see the #golang compiler using stack allocations to kill those noisy 1, 2, and 4-item heap allocations—even for escaping slices.
Optimized performance, automatically. go.dev/blog/allocatio…
become allocation aware #ziglang
1
0
1
125
Catch compile time errors in your comptime assertion blocks in tests, skip runtime test execution: `zig test --test-no-exec <file.zig>` #ZigLang #Zig
0
0
2
2,555
-freference-trace[=num]: How many lines of reference trace should be shown per compile error—handy for getting more context without noisy output.
#ziglang often tells you “references hidden; use -freference-trace=…” in the error message. #zig
0
0
0
187
Interesting historical context on the Ruby YJIT port discussion 4 years ago.

bugs.ruby-lang.org/issues/18481 Search 'Zig'

#ZigLang
0
0
0
230