linear types style mutation #759
Answered
by
stylewarning
confusedcharlotte
asked this question in
Help!
-
i have a small lisp library of macros and functions to enforce single use variables and i was wondering if there was a recommended way to do mutation in coalton. should i keep mutating functions on the lisp side of interop, or could i port some of this into coalton? like, does setf work? |
Beta Was this translation helpful? Give feedback.
Answered by
stylewarning
Oct 6, 2022
Replies: 1 comment 1 reply
-
Variable bindings themselves are not |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
confusedcharlotte
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Variable bindings themselves are not
mutable (there is no
(setf x y)
), but Coalton supports mutable cells. So you can usenew
to make a new cell,read
to get its value, andwrite!
to mutate it.