POP icon indicating copy to clipboard operation
POP copied to clipboard

Special Attributes

Open Pacman99 opened this issue 3 years ago • 1 comments
trafficstars

Many times there are attributes you want to include in a POP for utility purposes, but they shouldn't be in the end result(after unpopping). There should be some way to mark certain attributes as special.

This could also replace #1 since you can just add extenders in a pop's extension and mark those attributes as "special", so they get removed when unpopping.

p = pop {
  defaults.value = 0;
  extension = self: super: {
    # Mark increment as "special" somehow
    increment = pop { supers = [ self ]; extension = _: _: { value = super.value + 1; }; };
  };
}
unpop (p.increment.increment) => { value = 2; }

or with #7

pop {
  defaults.value = 0;
  extension = self: super: {
    increment = self (self: super: { value = super.value + 1; });
  };
}

cc @fare

Pacman99 avatar Jun 16 '22 17:06 Pacman99

In terms of the API I'm thinking it could be a list: pop { specialNames = [ "increment" ]; }. And maybe __meta__ and __unpop__ could be part of that list by default, so unpop doesn't have to know about those, it only has to know about the list of special properties.

Pacman99 avatar Jun 16 '22 20:06 Pacman99