mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
updated description for Boxing from Zulip discussion
This commit is contained in:
parent
d85a493abd
commit
74a337d508
1 changed files with 6 additions and 5 deletions
|
@ -2,14 +2,15 @@ interface Box
|
|||
exposes [box, unbox]
|
||||
imports []
|
||||
|
||||
## Allocate a value on the heap. Boxing is an expensive processes as it copies
|
||||
## the value from the stack to the heap.
|
||||
## Allocate a value on the heap. Boxing is an expensive process as it copies
|
||||
## the value from the stack to the heap. This may provide a performance
|
||||
## optimization for advanced use cases with large values. A platform may require
|
||||
## that some values are boxed.
|
||||
##
|
||||
## expect Box.unbox(Box.box "Stack Faster") == "Stack Faster"
|
||||
box : a -> Box a
|
||||
|
||||
## Return a value to the stack. Unboxing is an expensive processes as it copies
|
||||
## the value from the heap to the stack.
|
||||
## Returns a boxed value.
|
||||
##
|
||||
## expect Box.unbox(Box.box "Stack Faster") == "Stack Faster"
|
||||
unbox : Box a -> a
|
||||
|
@ -21,4 +22,4 @@ unbox : Box a -> a
|
|||
# boxed
|
||||
# |> Box.unbox
|
||||
# |> transform
|
||||
# |> Box.box
|
||||
# |> Box.box
|
Loading…
Add table
Add a link
Reference in a new issue