github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/zrealm_crossrealm5.gno (about) 1 // PKGPATH: gno.land/r/crossrealm_test 2 package crossrealm_test 3 4 import ( 5 "gno.land/r/demo/tests" 6 ) 7 8 // NOTE: it is valid to persist external realm types. 9 var somevalue tests.TestRealmObject 10 11 func init() { 12 somevalue.Field = "test" 13 } 14 15 func main() { 16 // NOTE: but it is invalid to modify it using an external realm function. 17 somevalue.Modify() 18 println(somevalue) 19 } 20 21 // Error: 22 // cannot modify external-realm or non-realm object