Scripting languages offer the comfort of automatic type inference. The way we approached this in our own scripting language
was by having meta-data alongside memory containing the data.
*A few commenters recommended unions. Although interesting, we prefered to extend the enum variables and keep the pointer variable flexible, instead of extending the struct with new types.
Languages that auto-magically infer the type from what you populate
your data. This meta-data is used to allow the correct operations to happen
on said objects.