Re: Choices for Vim9 class implementation

2022-12-25 Thread Bram Moolenaar
> > One thing I'm not yet sure about is the declaration. Currently it works > > like this: > > > > this.name: string > > this.gender: Gender > > > > Notice that there is no "var" keyword. It's not needed to recognize the > > declaration. I can't think of a good reason to add "v

Re: ASAN error seen when creating two instances of a class

2022-12-25 Thread Bram Moolenaar
Yegappan wrote: > With the latest Vim version (patch 9.0.1093), when sourcing the > following script: Should be fixed by patch 9.0.1093. -- Yesterday is history. Tomorrow is a mystery. Today is a gift. That's why it is called 'present'. /// Bram Moolenaar -- b...@moolenaar.net -- http://www

Re: Choices for Vim9 class implementation

2022-12-25 Thread Bram Moolenaar
> On Sunday, 25 December 2022 at 02:34:35 UTC+11 Doug Kearns wrote: > > > On Mon, 19 Dec 2022 at 00:33, Bram Moolenaar wrote: > > > >> > >> One thing I'm not yet sure about is the declaration. Currently it works > >> like this: > >> > >> this.name: string > >> this.gender: Gend

Re: Setting a public member variable generates an ASAN error

2022-12-25 Thread Bram Moolenaar
Yegappan wrote: > Sourcing the following script: > > - > vim9script > > class MyCar > public this.make: string > > def new(make_arg: string) > this.make = make_arg > enddef > > def GetMake() >

Patch 9.0.1094

2022-12-25 Thread Bram Moolenaar
Patch 9.0.1094 Problem:Compiler warning when HAS_MESSAGE_WINDOW is not defined. Solution: Add UNUSED. Files: src/vim9cmds.c *** ../vim-9.0.1093/src/vim9cmds.c 2022-12-18 21:42:49.014716925 + --- src/vim9cmds.c 2022-12-25 15:57:29.986071942 + *** *** 1973

Re: ASAN error seen when creating two instances of a class

2022-12-25 Thread Yegappan Lakshmanan
Hi Bram, On Sun, Dec 25, 2022 at 7:02 AM Bram Moolenaar wrote: > > > Yegappan wrote: > > > With the latest Vim version (patch 9.0.1093), when sourcing the > > following script: > > Should be fixed by patch 9.0.1093. > This issue is not fixed by 9.0.1093. I still see the ASAN traceback when sour

Re: ASAN error seen when creating two instances of a class

2022-12-25 Thread Bram Moolenaar
Yegappan wrote: > > > With the latest Vim version (patch 9.0.1093), when sourcing the > > > following script: > > > > Should be fixed by patch 9.0.1093. > > This issue is not fixed by 9.0.1093. I still see the ASAN traceback > when sourcing the script. I tried with valgrind. There is an erro

Patch 9.0.1095

2022-12-25 Thread Bram Moolenaar
Patch 9.0.1095 Problem:Using freed memory when declaration fails. (Yegappan Lakshmanan) Solution: After unreferencing an object set the reference to NULL. Files: src/typval.c, src/testdir/test_vim9_class.vim *** ../vim-9.0.1094/src/typval.c2022-12-08 20:41:55.433288306 +

Re: Choices for Vim9 class implementation

2022-12-25 Thread Ernie Rael
With 9.0.1094, in the script that follows, attempting to read a classMember through  an instance fails; echomsg c.classMember should it? I suppose requiring the class name makes it most clear, but I recall mention that classnames can get long. I suppose a getter could be added. Can a class

Patch 9.0.1096

2022-12-25 Thread Bram Moolenaar
Patch 9.0.1096 Problem:Reallocating hashtab when the size didn't change. Solution: Bail out when the hashtab is already the desired size. Files: src/hashtab.c *** ../vim-9.0.1095/src/hashtab.c 2022-11-25 16:31:46.964606667 + --- src/hashtab.c 2022-12-25 20:37:49.49926

Re: Choices for Vim9 class implementation

2022-12-25 Thread Bram Moolenaar
> With 9.0.1094, in the script that follows, attempting to read a > classMember through  an instance fails; > > echomsg c.classMember > > should it? No, an object does not provide a class member. > I suppose requiring the class name makes it most clear, but I recall > mention that classna

Patch 9.0.1097

2022-12-25 Thread Bram Moolenaar
Patch 9.0.1097 (after 9.0.1096) Problem:Tests are failing. Solution: Do clean up a hashtab when at the initial size. Files: src/hashtab.c *** ../vim-9.0.1096/src/hashtab.c 2022-12-25 20:46:07.527246097 + --- src/hashtab.c 2022-12-25 21:28:41.970208660 + **

Re: Choices for Vim9 class implementation

2022-12-25 Thread Ernie Rael
On 22/12/25 1:07 PM, Bram Moolenaar wrote: With 9.0.1094, in the script that follows, attempting to read a classMember through  an instance fails; echomsg c.classMember should it? No, an object does not provide a class member. I suppose requiring the class name makes it most clear, but

Re: Choices for Vim9 class implementation

2022-12-25 Thread Christopher Plewright
On Monday, 26 December 2022 at 09:08:22 UTC+11 err...@raelity.com wrote: > On 22/12/25 1:07 PM, Bram Moolenaar wrote: > > With 9.0.1094, in the script that follows, attempting to read a > classMember through an instance fails; > > echomsg c.classMember > > should it? > > No, an object does

Re: Choices for Vim9 class implementation

2022-12-25 Thread Ernie Rael
On 22/12/25 2:54 PM, Christopher Plewright wrote: On Monday, 26 December 2022 at 09:08:22 UTC+11 err...@raelity.com wrote: On 22/12/25 1:07 PM, Bram Moolenaar wrote: With 9.0.1094, in the script that follows, attempting to read a classMember through  an instance fails; e

Re: Choices for Vim9 class implementation

2022-12-25 Thread Christopher Plewright
> > > > I thought that the declaration would be like this; > > > > this.name : *string *= "Somebody" > > > > Or is auto-type detection at play here too? > > It's called type inference. The type of the expression is used as the > type of the variable. In most cases this works very well, keeps

Re: Choices for Vim9 class implementation

2022-12-25 Thread Christopher Plewright
On Monday, 26 December 2022 at 10:26:50 UTC+11 err...@raelity.com wrote: > On 22/12/25 2:54 PM, Christopher Plewright wrote: > > I didn't know it was documented that there could be a static class > function. The whole point of the question was to determine if there could > be a static class fu