diff options
author | Robby Zambito <contact@robbyzambito.me> | 2023-02-21 16:56:01 -0500 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2023-02-21 16:56:01 -0500 |
commit | 863f67d2ab3423e840f3bf09f965b64819d8e5db (patch) | |
tree | 154544413737108830602296b457cc0401485a09 | |
parent | 26197ab6e647ae9e37fb56f7844cf711fc10409c (diff) |
Mutating an empty object should return a new object if it cannot be mutated.
-rw-r--r-- | lib/zambyte/meta/gauche.scm | 2 | ||||
-rw-r--r-- | lib/zambyte/meta/guile-json.scm | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/zambyte/meta/gauche.scm b/lib/zambyte/meta/gauche.scm index 59b82c0..51972a0 100644 --- a/lib/zambyte/meta/gauche.scm +++ b/lib/zambyte/meta/gauche.scm @@ -61,7 +61,7 @@ (set-cdr! (assoc (symbol->string key) json) value) json) ((null? json) - (error "json-object-set!: cannot set on an empty object" json)) + (json-object (cons key value))) ((list? json) (append! json (list (cons (symbol->string key) value)))) ((json-record? json) diff --git a/lib/zambyte/meta/guile-json.scm b/lib/zambyte/meta/guile-json.scm index a5815ff..903182b 100644 --- a/lib/zambyte/meta/guile-json.scm +++ b/lib/zambyte/meta/guile-json.scm @@ -48,7 +48,7 @@ (set-cdr! (assoc (symbol->string key) json) value) json) ((null? json) - (error "json-object-set!: cannot set on an empty object" json)) + (json-object (cons key value))) ((list? json) (append! json (list (cons (symbol->string key) value)))) ((json-record? json) |