I've had trouble with tsc (TypeScript compiler)'s get and set in the past, as well as I don't see much benefit.
tsc
get
set
Also the same case with Python, I see get and set as generally should be avoided, as they may obscure implementation.
The only real time I see benefit, is in Vue class components, where get will be translated to Vue getters, therefore cached.
I tend to forget about them and don't use them often, can't see why. I was hoping somebody explained how they used them and why.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I've had trouble with
tsc
(TypeScript compiler)'sget
andset
in the past, as well as I don't see much benefit.Also the same case with Python, I see
get
andset
as generally should be avoided, as they may obscure implementation.The only real time I see benefit, is in Vue class components, where
get
will be translated to Vue getters, therefore cached.I tend to forget about them and don't use them often, can't see why. I was hoping somebody explained how they used them and why.