chasm icon indicating copy to clipboard operation
chasm copied to clipboard

Empty slices in maps

Open Earthcomputer opened this issue 1 year ago • 4 comments

So far we have two types of targets that a transformer can replace: node targets and list slice targets. I propose adding a third type of target, a map empty slice target.

Motivation

You can insert into a list by replacing an empty slice in the list. However, there is currently no way to insert into a map without replacing the whole map. Therefore I am proposing this to be able to insert into a map.

This would solve the issue raised by @CheaterCodes here, and make it easier to improve the chasm tree further before release if necessary.

Implementation

An empty map slice in chasm will look something like the following, with a boolean specifying whether we're targetting the entire map or an empty slice within the map.

{
   node: foo.some_map,
   inside: true, // true if this is an empty map slice ("inside" the map), false if it's the whole map (the default).
}

The locking behaviour of an empty map slice would be similar to that of an empty list slice; that is, never conflicting with another empty map slice, and only ever conflicting with locks that target the map itself or any of its parents.

The Chasm implementation will have to be updated to support a third type of slice.

Earthcomputer avatar Jan 21 '23 13:01 Earthcomputer