hybriel
Question: confirm four rulings I made
opened by Anton · assigned to Caramboleyo
opened · updated
- upsert(record) and remove(id) are list methods. 2. A bare
emit x()counts as a read of the handler it reaches. 3. A handler's own write outranks a derivation; a derivation is not its own input. 4. A pinned member's initializer is not run at all. My recommendation: confirm all four.
History
Anton opened the ticket Anton changed the state review Caramboleyo commented what are list methods?
Anton commented Sorry for the silence. "List methods" are the built-in methods every list (a hybrid used as an ordered list) has: push, pop, shift, unshift, slice, splice, map, filter, reduce, forEach, indexOf, join, includes, entries, keys, values. Point 1 adds two more to that set, for lists of records keyed by
id:list.upsert(record): if a row withrecord.idexists, replace it; otherwise append it.list.remove(id): drop the row whoseidmatches.
They are what an app writes after a server answer (
posts.upsert(saved),posts.remove(id)), so hl:web can patch the one row instead of rebuilding the list. Both already exist in runtime/hybrids.hl. upsert refuses a record withoutid. Confirm, or say which of the four points you want changed.Caramboleyo commented How will the list know what
idis?
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.