Open mimoo opened 2 years ago
Also. If I want to copy/clone a var, it should be easy.
Perhaps let x = y is enough.
Create the number of necessary internal var and wire them?
Do I need to wire them? Perhaps I don't because things are indeed passed by value lol
What does reassign do again?
Ok proposition: dont allow mutation of arguments of functions in general. Like that if someone tried they get an error. Easy
It also sounds like let x = y should already work, as we would reassign vars on x and not y if we try to mutate x!
Everything is actually copy on write!
If var is mutable, pass by pointer, otherwise pass by cvar
A var is in noname A cvar is internal A fvar is a field ellement or cellvar
Call it reference not pointer. Or even better "mutable reference"
Currently everything is passed by reference in the language. There is no such thing as passing by value.
You can mutate local variables if there's the keyword mut.
When you pass a variable to a function, I believe it can mutate the variable eventhough it might not be mutable... we need to change that. Perhaps functions should annotate what args they might want to modify?