Sunday, March 26, 2023

Re: [vim9script] Forward declarations for classes?

On 2023-03-26, Bram Moolenaar <Bram@moolenaar.net> wrote:
> The second one should just work. Currently the class is only defined
> when "endclass" is found. Doing it earlier is more implementation work,
> but it should not require anything on the user side.
>
> For the first example I'm not sure what the best solution is. There is
> a plan to add some kind of typedef, but it would still require something
> extra to indicate the actual implementation will follow later.

Typedefs would look super nice to me, but for another reason: type
aliasing would make my code a lot easier to read!

> There is trouble when it's not just the class name that needs to be
> known, but also what it contains. Then a forward declaration quickly
> becomes a lot of duplicate text. And recursive dependencies need to be
> handled, which is also relevant in this example.

Thanks for the thorough reply. This is not a blocker, at least for the
code I write, as `any` is a sufficiently good workaround, which perhaps
requires some extra care with typing in some cases, but nothing
dramatic. Looking forward to seeing these last issues being ironed out!

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/tvqfk5%245j9%241%40ciao.gmane.io.

No comments: