> > One thing I'm not yet sure about is the declaration. Currently it works 
> > like this: 
> >
> > this.name: string 
> > this.gender: Gender 
> >
> > and 
> 
> var name: string
> var gender: Gender
> 
> to declare them. 

That is indeed an alternative, and more like a normal declaration.
Although in Typescript, which syntax has been mostly used for
declarations, it would be:

        name: string;
        gender: Gender;

Unfortunately, this doesn't stand out and easily gets lost in a long
class.  It would require the habit of putting all the members at the
start of the class.

Other languages, like Java, put the type before the name and also don't
have a keyword, e.g.:

        String name;
        Gender gender;

There are advantages and disadvantages of using the normal "var" style
declarations.  But it appears that most language don't declare object
members with a keyword.

I still like the consistency of always prefixing the object members with
"this.", instead of having it depend on the context.


-- 
A mathematician is a device for turning coffee into theorems.
                                        Paul Erdos
A computer programmer is a device for turning coffee into bugs.
                                        Bram Moolenaar

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20221219142609.543541C09D3%40moolenaar.net.

Reply via email to