diff --git a/src/ast/expr.rs b/src/ast/expr.rs index e5208eee..e86531d0 100644 --- a/src/ast/expr.rs +++ b/src/ast/expr.rs @@ -362,6 +362,8 @@ pub enum Expr { /// /// Used to hold complex constants such as [`Array`][crate::Array] or [`Map`][crate::Map] for quick cloning. /// Primitive data types should use the appropriate variants to avoid an allocation. + /// + /// The [`Dynamic`] value is boxed in order to avoid bloating the size of [`Expr`]. DynamicConstant(Box, Position), /// Boolean constant. BoolConstant(bool, Position), diff --git a/src/types/dynamic.rs b/src/types/dynamic.rs index f95a2275..1a37cd16 100644 --- a/src/types/dynamic.rs +++ b/src/types/dynamic.rs @@ -186,6 +186,9 @@ pub enum Union { TimeStamp(Box, Tag, AccessMode), /// Any type as a trait object. + /// + /// An extra level of redirection is used in order to avoid bloating the size of [`Dynamic`] + /// because `Box` is a fat pointer. Variant(Box>, Tag, AccessMode), /// A _shared_ value of any type.