From 863f67d2ab3423e840f3bf09f965b64819d8e5db Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Tue, 21 Feb 2023 16:56:01 -0500 Subject: Mutating an empty object should return a new object if it cannot be mutated. --- lib/zambyte/meta/guile-json.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/zambyte/meta/guile-json.scm') 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) -- cgit