Jim Peters

Results 88 comments of Jim Peters

It has to support deletions as you iterate through (see Lua docs for `next`), so it's bound to be a little bit special.

Lua says that deletions and modifications are okay, but insertions are not okay whilst iterating, but it doesn't enforce that at the language level like a Rust implementation would. I...

Just thinking some more about this. If you don't want to store the array-part of the table separate to the hash, you could just simulate the array-length `#v` instead, e.g....

Yes, agreed. As you say it's "extremely specific and weird", and not really a Rust-like interface, but it's not a safety problem for someone to expose that interface on their...

Deletions wouldn't work with an `IndexMap` either. The last item is moved to fill the gap, messing up the indices. I can't see any easy solution yet.

Following comments on Reddit, theoretical cost increases as O(N ln N) and ideally we should use a "sorting network" to implement the comparisons. But still no-one has come up with...

Okay, for your code example, I would have put the cells inside of the Storage. If you were using TCell or TLCell, that would have zero overhead in memory or...

I've been thinking some more about this idea of using QCell/etc to get mutable access to various entries in a hashmap or other collection simultaneously (rather than borrowing just one...

Just because we can do something doesn't mean we should. Can I back up a bit and ask about motivation? Do you have a motivating example of where this is...

Okay, thanks. I think I'd need to see an example even if someone claimed they needed 4 or more, because there may be another way that is more efficient. For...