Sunday, July 23, 2023

[vim9script] How to compare two objects for identity vs equality?

The following test passes:

```vim
vim9script

class C
endclass

def Test_ObjectEquality()
var o1 = C.new()
var o2 = C.new()

assert_true(o1 == o2)
enddef

v:errors = []
Test_ObjectEquality()
echo v:errors
```

Fine, == is value-based equality. Is there a way to compare for
identity, that is, so that o1 and o2 are considered two different
instances?

Thanks,
Life.



--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/u9jr7p%2425h%241%40ciao.gmane.io.

No comments:

Post a Comment