[extension-types] Boxing? #1491
Labels
extension-types-later
Issues about extension types for later consideration
inline-classes
Cf. language/accepted/future-releases/inline-classes/feature-specification.md
question
Further information is requested
The proposal in #1452 introduces the notion of boxing for an explicit extension type. A boxed entity obtained from an object whose static type is an extension type is an actual wrapper object where all the extension methods are available as regular instance members. This means that member invocation is subject to object-oriented dispatch (and even dynamic invocations are possible).
The purpose of boxing is that it enables a choice: We may wish to use an extension type
E
to work on a large number of objects using a specific interface, without paying for the abstraction in terms of allocating and initializing wrapper objects. However, if a few of the objects must be used in some other context where the static type cannot beE
then we'd need a wrapper object. This is safe and easy when boxing is a built-in mechanism.The text was updated successfully, but these errors were encountered: