question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement getters/setters

See original GitHub issue

I would like to have getters/setters all across the code.

This would allow to access (and modify) all those things that now have a getWhatever() and setWhatever method, like L.Map.getZoom() and L.Map.setZoom()

e.g. instead of:

map.setZoom(map.getZoom() + 1);

one could do:

map.zoom++; 

I guess some of the code would become much more simpler. The main downside is that getters/setters are part of the ECMAscript 5 standard, so IE8 is out. Other downside is that it seems that the only way to copy getters/setters from an L.Class.extend(mixin) definition is to resort to the method described in #3464, which might affect performance.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mournercommented, Sep 27, 2016

I’m not a fan of getters/setters, having used them in GL JS. They do all the work that’s happening under the hood implicitly, which often makes it much harder to debug. Lacking IE8 support is also a blocker for now.

0reactions
jonkoopscommented, Apr 26, 2022

Adding this to the v2 milestone, and since this would be a breaking change I will mark it as such.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getter and Setter in Java - GeeksforGeeks
It sets the value for any variable used in a class's programs. and starts with the word “set” followed by the variable name....
Read more >
Getters and Setters in Java Explained - freeCodeCamp
Getters and setters are used to protect your data, particularly when creating classes. For each instance variable, a getter method returns ...
Read more >
Significance of Getters and Setters in Java - Baeldung
Getters and Setters play an important role in retrieving and updating the value of a variable outside the encapsulating class.
Read more >
Java Encapsulation and Getters and Setters - W3Schools
declare class variables/attributes as private; provide public get and set methods to access and update the value of a private variable. Get and...
Read more >
Getters and Setters Methods in Java - CodeGym
In today's lesson, we'll talk about Getters and Setters in Java. ... He creates his own Main class, where he begins to use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found