Skip to content
Discussion options

You must be logged in to vote

Correct, val has nothing to do with storage - it is just an immutable binding. If you make something a value type though, it will be stack-allocated and passed via the stack itself (saying nothing about its fields - which will be stack / heap allocated based on their type). When you get to polymorphic functions though, there needs to be a uniform representation, so even stack-allocated values will temporarily be boxed for that.

Some values like small integers / strings are boxed in-place (no allocation). They will have a tag that distinguishes them from regular pointers. However, Koka has arbitrary precision integers, so if they get large enough, they won't fit in the pointer sized storag…

Replies: 1 comment

Comment options

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