Rust's ownership model: passing a value transfers ownership (move); taking a `&value` lets you read without taking ownership; `&mut value` lets you modify without taking ownership. Only one mutable borrow OR many immutable borrows at a time.
Use pointers when you want to mutate the callee's value, share a large struct without copying, or distinguish "no value" via nil. Go has no pointer arithmetic — much safer than C.
Channels are typed pipes between goroutines. Unbuffered = synchronous handoff; buffered = up to N values queued. Close a channel to signal "no more values" — receivers see ok=false.
Go Struct Embedding (Composition over Inheritance)
Go has no inheritance. Embed a type to "promote" its fields and methods as if they were on the outer type. Same effect as inheritance for most purposes, but explicit.
`val` is read-only (can't reassign the reference); `var` is mutable. Default to `val` everywhere — Kotlin's style guide recommends it, and a Compiler warning fires if a `var` is never reassigned.
`...T` in the last parameter slot accepts zero or more T values. Pass a slice by suffixing with `...` to spread it. Used everywhere from `fmt.Println` to custom builders.
`struct{}` is a zero-size value — no memory cost. Use it as the value type in a Set (`map[T]struct{}`), as a channel signal (`chan struct{}`), or as a marker type.
When you have an `interface{}` (or any) and need to dispatch on its underlying type, use `switch v := x.(type)`. Cleaner than a chain of type-assertions.
Kotlin functions are first-class values. A lambda is `{ args -> body }`; its type is `(InputTypes) -> ReturnType`. Single-argument lambdas can use the implicit `it` parameter.
Kotlin's `when` is an expression (returns a value), supports ranges, type checks, multiple values per branch, and arbitrary boolean conditions. Replaces nested if/else AND traditional switch.
`defer` runs a statement when the enclosing function returns — LIFO order. `panic` aborts; `recover` (inside a deferred func) catches a panic and converts it back to a normal return. Use sparingly.
Kotlin Nullable Types — String? and the ? Operator
Kotlin distinguishes `String` (never null) from `String?` (may be null) in the type system. The compiler refuses to compile code that could deref a possibly-null value — the famous "no more NullPointerException" feature.
Go functions can return multiple values — most idiomatically a `(result, error)` pair. Named returns let you document the meaning of each value AND enable naked returns in short functions.
Methods are functions with a receiver argument. Use pointer receivers when you mutate, when the struct is large, OR for consistency (mixing pointer + value receivers on the same type is a common bug source).