pub(crate) fn set_const(&mut self, id: IdentId, val: Value) {
        if let Some(mut module) = val.if_mod_class() {
            if module.op_name().is_none() {
                if self.class_id() == BuiltinClass::object().class_id() {
                    module.set_name(id.get_name());
                } else {
                    match &self.ext.name {
                        Some(parent_name) => {
                            let name = format!("{}::{:?}", parent_name, id);
                            module.set_name(name);
                        }
                        None => {}
                    }
                };
            }
        }

        if let Some(ConstEntry::Value(_)) = self.ext.insert_const(id, val) {
            eprintln!("warning: already initialized constant {:?}", id);
        }
    }
Set a constant (`self`::`id`) to `val`.

If `val` is a module or class object, set the name of `val` to the name of the constant.
If the constant was already initialized, output warning.
ruruby/src/value/class.rs