If only C++ had a thing called "references", which conveniently also used the "&" symbol and are a way to do exactly this without pointers.
Yes. E.g. every language where you can pass pointers can do this. Reference are a construct around pointers.
>Of the ones I listed, I use all of, and am continuously frustrated by this limitation.
Why? This is only a limitation for a few basic types. All the language you mention allow you to modify objects passed to a function.
If it ever were any issue though you can always return the modified object and overwrite the original.
a = modify(a)
works even if you can only pass a value.
In practice this should never be a limitation, certainly I have never encountered it as one.
Hint: Python and Javascript will use the type passed to determine mutability. Kotlin will let you pass a mutableStateFlow etc that can be used for, e.g., top-level data structure, but not an arbitrary variable. (e.g. a data structure field, or free variable).
The most popular languages, outside of C and C++, cannot pass pointers. And, raw pointers are not ideal; they lose type safety, memory safety etc.
There are always canonical patterns for a given language to write a function like I did. I find them to be universally more complicated and less explicit/versatile than what I posted; they require code to permeate beyond the function signature.
class A:
a = 0
def modify (v): v.a = 2
a1 = A()a1.a = 1
print(a1.a)
modify(a1)
print(a1.a)
I have never seem a codebase where this was an issue. The most important concept in programming is defining your data structures. Professional programs almost never operate on primitive data structures, but always on larger structures, like classes or structs.
This is why this is only a problem for you. I don't want to be insulting, but you need to brush up on your data structures. The need to pass a modifiable data structure almost never arises, the idiom in your OP is extremely uncommon and would likely not pass any code review.