stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

Replace dict.update with new implementation

Open inoas opened this issue 1 year ago • 5 comments
trafficstars

  • rename dict.update to dict.upsert
  • deprecate dict.update
  • 2.0 let dict.update return Result and Error if no key found

inoas avatar Apr 24 '24 21:04 inoas

Is there interset in this, then I'd create a PR.

inoas avatar May 22 '24 00:05 inoas

Let's do it!

  1. Deprecate dict.update and introduce dict.upsert
  2. Remove dict.update
  3. Introduce the new dict.update

lpil avatar May 23 '24 11:05 lpil

Is there still any interest in a change/alter function as in #599?

mooreryan avatar May 29 '24 14:05 mooreryan

That's what the new dict.update is to be

lpil avatar May 29 '24 17:05 lpil

@lpil as short as possible:

  1. https://github.com/gleam-lang/stdlib/issues/599 seems to be about a function that either updates or removes or adds values to a dict
  2. while my PR https://github.com/gleam-lang/stdlib/pull/610 is a simple change to the old update to return a Result and simplfy the apply function at the same time.

I do not want to steal anyones opportunity here and am happy to do whatever consensus arrises or whatever the core team decides.

I like all three: the new upsert, the new update and the proposed change/alter (last has the highest complexity to use however)

inoas avatar May 29 '24 20:05 inoas