Well, we don't need to, oh, sorry. We don't need to freeze anymore, because it's completely immutable. Infinite connections try to change my config. It's just going to crash. So problem solved, I guess.
When it comes to the second problem, well, we talked about equality with triple equal. But map will also follow the same kind of equality. That means that if my coordinates from an object becomes a record, now it's basically of references to the coordinates, it's going to compare the internal values of the coordinates. So if I create a copy of exactly the same coordinates, since the values inside of the coordinates record are going to be the same, we're going to still be able to look up our boot.
Finally. What about object cycles and unserviceable objects and values? I talked about that earlier. Well, you won't be able to make them with record and tuple structures. We're going to get to that a bit later. And what about the key ordering fragility with the stringify I showed to you earlier? If I insert my keys in a different order, would that change anything? With records, no. Because records don't memorize the insertion order, they just lexically return the keys in the order that are lexically ordered. So if I take the two coordinates, if I insert my keys in a different way, it doesn't matter, still the same values inside, still the same equality.
There is though no free lunch here. You cannot do some things with records and tuples, and for good reasons, and we're going to go through them. First of all, you cannot put an object in there. If you look in this slide, I forgot to put a hash in front of my db object here. It's an object now, it's not a record, and records don't like to have objects in them. Unfortunately, that also goes for functions because functions happen to be objects. There is still a way to fix that problem, and I'm not going to talk about it because it's a solution that you will be able to use it, but I only have nine minutes left, so I need to speed up.
Okay, so now we're going to talk about how you can derive changes. Obviously you cannot change things in place, you cannot push values in place to a tuple. How do you do this? Well, with arrays, you can concat things using the spread. You can do that with tuples as well, and as a matter of fact, you can do that with records as well. So if I just want to change one value in my proposal and create the future, I'm going to update it by spreading the proposal and changing the stage key here. We're not there yet, but soon. Okay, beyond that, there are some really useful methods on the array prototype, right? For example, reverse.
Comments