Skip to content

Question about preloading: "exception: set: Map instance is read-only!" #1457

Answered by phoddie
linfan68 asked this question in Q&A
Discussion options

You must be logged in to vote

Glad to hear that you are enjoying preload. It is close to magic, so it is easy to overlook the details.

Everything you describe is exactly as expected. There's one key thing to understand. Anything that is preloaded is, of course, stored in immutable ROM (flash memory) and so cannot be modified. But, XS has an aliasing mechanism for certain preloaded objects which are not explicitly frozen. XS always freezes functions (and consequently classes, since they are "just" functions) and instances of most built-ins. But, it does not automatically freeze plain JavaScript objects. Of course, are placed into ROM too, but XS also creates an entry for the object in its alias table. When a script att…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by linfan68
Comment options

You must be logged in to vote
1 reply
@phoddie
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants