joel
2021-2-18 15:48:27

This is helpful actually. I’ve seen the term used a lot but never knew what it meant


joel
2021-2-18 15:49:29

I’ve had a similar noob knowledge gap that I haven’t found the answer to: what is the use case for a “box”?


samth
2021-2-18 15:50:05

a single mutable location that you can pass around as a value


joel
2021-2-18 15:50:10

The docs say “minimal mutable storage” but why would I need the boxing/unboxing mechanism


samth
2021-2-18 15:50:50

you can pass a box as an argument or store it somewhere, which you can’t do with a variable that you use with set!


joel
2021-2-18 15:53:15

So if I define a variable x and use set! on it I can no longer use x as an argument in a function call? Or are you saying this is a way to pass it by reference instead of by value so the function can also (set! x 5) and x is now 5 at the calling site too


samth
2021-2-18 15:53:31

the latter


joel
2021-2-18 15:53:39

Ah ok!


joel
2021-2-18 16:01:34

Was there something I missed or would this be useful to add to the box section in the Racket Guide?


kellysmith12.21
2021-2-18 16:02:31

One way to think of a box is as a pointer: unboxing is like dereferencing.


joel
2021-2-18 16:05:11

Yes ok. That totally makes sense


samth
2021-2-18 16:16:53

More examples are always great


yilin.wei10
2021-2-18 19:42:58

My cat has learnt the shortcut to rfkill my laptop.


yilin.wei10
2021-2-18 19:43:15

I don’t know the rfkill shortcut.


yilin.wei10
2021-2-18 19:43:47

But he does it approximately 19 out of 20 times he walks on my laptop.


jcoo092
2021-2-18 21:41:33

:keyboard::tiger2:


hyamanak
2021-2-19 02:02:42

@hyamanak has joined the channel