What does it mean to say a type is “boxed”?

后端 未结 6 1379
刺人心
刺人心 2020-12-11 00:15

I have heard of types being referred to as \"boxed\" in some languages.

In Java, I have heard of \"autoboxing\". What is this? Is it having wrapper classes for a ty

6条回答
  •  执笔经年
    2020-12-11 00:51

    A boxed type means that the values are allocated in a block on the heap and referenced through a pointer. This is good for uniformity in the implementation of the runtime (it makes it easier to have generic functions, etc), at the cost of an additional indirection.

提交回复
热议问题