Sunday, March 26, 2023

[vim9script] Forward declarations for classes?

Consider the following example:

class Rgb
this.r: float
this.g: float
this.b: float

def ToHsv(): Hsv
# ...
enddef
endclass

class Hsv
this.h: float
this.s: float
this.v: float

def ToRgb(): Rgb
# ...
enddef
endclass

In a scenario like the above, the return type of ToHsv() must be changed
to `any`. Is a mechanism to make the above code legal being considered?

Of a similar flavour:

class X
def Clone(): X
# Return a copy of this
enddef
endclass

Currently, Clone() must be typed as `any`.

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/tvp84d%24iro%241%40ciao.gmane.io.

No comments:

Post a Comment