Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't allow override of turtle id #78

Open
m0ose opened this issue Aug 29, 2023 · 4 comments
Open

don't allow override of turtle id #78

m0ose opened this issue Aug 29, 2023 · 4 comments

Comments

@m0ose
Copy link
Collaborator

m0ose commented Aug 29, 2023

It turns out that it turtle list is sorted by id, and if you set the id it will mess some internal things, like turtle removal.

Maybe the turtle id should be private, or have a setter that gives you a warning to avoid shooting yourself in the foot?

@backspaces
Copy link
Owner

backspaces commented Aug 30, 2023

I agree! "Private", as per
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields
..looks pretty useful. Have you tried it?

I'm surprised that all the browsers support it, and so quickly.

@m0ose
Copy link
Collaborator Author

m0ose commented Aug 30, 2023

I haven't used the private class fields. It looks well supported, https://caniuse.com/mdn-javascript_classes_private_class_fields

@backspaces
Copy link
Owner

This is more difficult than it seemed. Turns out use of private variables is class based but AS makes heavy use of prototypal methods. So this basically depends on: #83

@m0ose
Copy link
Collaborator Author

m0ose commented Oct 4, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants