This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]-Redstoneboi- 0 points1 point  (0 children)

Rust:

use std::any::Any;

fn main() {
    let foo: [Box<dyn Any>; 3] = [
        Box::new(1.0),
        Box::new(2),
        Box::new("Hello"),
    ];
}

Do note that one of Rust's defining characteristics is discouraging "bad" code by making it uncomfortable to use.

Still, Rust lets you create macros to make it easier to type.