agentscript icon indicating copy to clipboard operation
agentscript copied to clipboard

don't allow override of turtle id

Open m0ose opened this issue 1 year ago • 4 comments

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?

m0ose avatar Aug 29 '23 19:08 m0ose

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.

backspaces avatar Aug 30 '23 14:08 backspaces

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

m0ose avatar Aug 30 '23 16:08 m0ose

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: https://github.com/backspaces/agentscript/issues/83

backspaces avatar Oct 04 '23 15:10 backspaces

Could it be renamed to something less common like id ?

On Wed, Oct 4, 2023, 9:53 AM Owen Densmore @.***> wrote:

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 https://github.com/backspaces/agentscript/issues/83

— Reply to this email directly, view it on GitHub https://github.com/backspaces/agentscript/issues/78#issuecomment-1747193848, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADADQRUJODL37PYQY553XLX5WBA3AVCNFSM6AAAAAA4DOQXQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXGE4TGOBUHA . You are receiving this because you authored the thread.Message ID: @.***>

m0ose avatar Oct 04 '23 16:10 m0ose