Skip to content

In-place mutation? #117

Answered by daanx
dan-zheng asked this question in Q&A
Dec 22, 2020 · 3 comments · 4 replies
Discussion options

You must be logged in to vote

Hi @dan-zheng ; good questions! Here are some answers:

  1. The builtin var gives local variables whose lifetime is limited to their lexical scope. These are "builtin" and do in-place updating for efficiency. However, the semantics of var is specified as using a regular state-effect handler (using a monadic approach) -- this makes them in practice a bit less efficient than C local variables as they are currently heap allocated (but this could be avoided though with a more sophisticated implementation I think). This is needed for giving the right semantics under multiple resumptions. I put "builtin" in quotes as the actual implementation is done in the std/core/types and std/core/hnd modules u…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@dan-zheng
Comment options

@patrickmn
Comment options

@dan-zheng
Comment options

Comment options

You must be logged in to vote
1 reply
@dan-zheng
Comment options

Answer selected by dan-zheng
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants