From 625fdfeb39c616c37ed4d17be2e3101e0ef2176c Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Fri, 27 Sep 2024 11:15:35 -0400 Subject: [PATCH] Revert "object: rename" This makes things much slower for questionable benefit. A better version might use a hash table. A better interpreter would use some form of partial evaluation to optimize the EQ? chain. This reverts commit 4acea69841ad62ec5d46eb565bbb5d98f84b3d38. --- linked-list.scm | 2 +- object.scm | 16 ++++++---------- read.scm | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/linked-list.scm b/linked-list.scm index 814f83f..67e32ab 100644 --- a/linked-list.scm +++ b/linked-list.scm @@ -27,7 +27,7 @@ ((head '()) (tail '()) (this - (object/abstract + (object/immutable-attributes 'push! (lambda (val) (set! head (cons val head)) diff --git a/object.scm b/object.scm index 6728661..d30574d 100644 --- a/object.scm +++ b/object.scm @@ -41,7 +41,6 @@ (if (not proc) (error 'object 'invalid-op op args) (apply proc args)))))) - (lambda (op . args) (let ((proc (table 'get op))) (if (not proc) @@ -65,14 +64,11 @@ (apply process-args args))))) (apply check-args args))))) -(define object-make-abstract! - (lambda (obj) - (obj 'delete! 'set!) - (obj 'delete! 'get) - (obj 'delete! 'delete!) - obj)) - ;;; Like OBJECT/ATTRIBUTES, but with SET!, GET, and DELETE! removed. -(define object/abstract +(define object/immutable-attributes (lambda args - (object-make-abstract! (apply object/attributes args)))) + (let ((obj (apply object/attributes args))) + (obj 'delete! 'set!) + (obj 'delete! 'get) + (obj 'delete! 'delete!) + obj))) diff --git a/read.scm b/read.scm index e1e3243..75d22e0 100644 --- a/read.scm +++ b/read.scm @@ -77,7 +77,7 @@ (datum-labels '()) (fold-case? #f) (this - (object/abstract + (object/immutable-attributes 'process (lambda (ch) (this 'update-position! ch)