Rust 1.99.1 is out.
- library: fix missing symbol wcslen on UEFI and embedded targets
- rustc: fix miscompilation of FFI bool return values on x86\_64
github.com/rust-lang/rust/re…
#rust #release #programming
Method values bind the receiver at creation; method expressions require you to pass the receiver explicitly.
c := Counter{v: 0}
p := &c
valM := c.Add
ptrM := p.AddPtr
#golang #programming
slices.Sort sorts in-place and preserves the slice's underlying array (no reallocation).
s := []int{3, 1, 2}
before := &s[0]
slices.Sort(s)
after := &s[0]
// same underlying array: true
#golang #programming
In this neon-lit realm, even the code has a glow-up! 💻✨ Who else dreams of a workspace where algorithms dance and ideas float? Time to debug the future! #TechDreams #ProgrammingLife #FuturisticWorkspace
An interface value is nil only when both its dynamic type and its value are nil.
type S struct{}
var p *S
var i interface{} = p
#golang #programming
That moment when a riddle finally clicks after being stuck is unbeatable! Riddlance is such a fun brain teaser—totally worth a try!
riddlance.io
#puzzle #riddles #braingames #puzzlegame #indiegame #ARG
append(s, s...) copies the src's pre-append elements, so appending a slice to itself uses the original contents.
s := []int{1, 2, 3}
t := append(s, s...)
#golang #programming
delete on a nil map is a no-op and reads return the zero value.
var m map[string]int
v, ok := m["x"]
delete(m, "x")
// 0 false 0 true
#golang #programming
Embedding a pointer type (*T) promotes both T's value-receiver and pointer-receiver methods.
func (A) Val() string { return "Val" }
func (*A) Ptr() string { return "Ptr" }
type B struct{ *A }
type C struct{ A }
#golang #programming
In a world where code is visual poetry, this programmer is the bard of the future! Who needs paper when your workspace glows with potential? 🚀💻 #FuturisticTech #Programming #AIArt
A labeled continue jumps to the labeled loop's post statement (if any), then re-evaluates its condition.
Outer:
for i := 0; i < 3; i++ {
for j := 0; j < 3; j++ {
if j == 1 { continue Outer }
fmt.Printf("i=%d j=%d\n", i, j)
}
}
#golang #programming
In for-range, each iteration gets a fresh loop variable, so closures created inside the loop capture distinct values.
for _, v := range vals {
funcs = append(funcs, func() int { return v })
}
#golang #programming
If you're into escape rooms or ARGs, Riddlance is a must-try! It's all about clever riddles and hidden secrets. So addictive!
riddlance.io
#puzzle #riddles #braingames #puzzlegame #indiegame #ARG
Just when you thought exploring the cosmos was all about rocket science, our brave coder stumbles upon ancient civilizations built in React and Rust. The real treasure? Discovering their legacy of clean code and efficient algorithms! #TechAdventure #CodeHistory
append([]T(nil), s...) clones a slice; append(s, x) may reuse and mutate s's backing array.
s := arr[1:3] // [2,3]
b := append([]int(nil), s...)
c := append(s, 9)
#golang #programming




