Right now the not-null ObjectRef is **opt-in**. That means by default an ObjectRef is nullable. We can gradually change the Ref types to not nullable, the steps are:
- Change macro to `TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS`, - Remove the default constructor(if already defined) that corresponds to nullptr if there is a custom defined one. - Fix the compile error - For structs that takes the ref as a member, possibly due to unavailable default constructor, change to a new copy constructor - For cases that needs nullable version, use Optional See example change for String https://github.com/apache/incubator-tvm/pull/5314/files#diff-6597547f217e514b638f9548fda1dbcaR528 So hopefully the upgrade will be smooth and incremental instead of a one-time big change. In the meanwhile, we do recommend to directly start using `Optional<T>` in cases where nullptr behavior is required. Once we have migrated most of the Ref, we might decide to change the default behavior to **opt-out**. Which means, by default `_type_is_nullable` property for the ObjectRef is set to be true. --- [Visit Topic](https://discuss.tvm.ai/t/allow-non-nullable-object-and-introduce-optional-t/6337/5) to respond. You are receiving this because you enabled mailing list mode. To unsubscribe from these emails, [click here](https://discuss.tvm.ai/email/unsubscribe/dc39157ed3b8a213b390492f717497f0dbeaedf624875447387f0fafe4621f51).