summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-09 07:45:05 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-09 07:45:05 -0800
commita52a10871b45806db86476fc17092368bcc5b1c3 (patch)
treee03fdd4f1ed7dd123fb3e55f4c23ecbae17c2c71 /share
parenta824ded1de5099e860e119bec1d3a2ed5e12a1ba (diff)
downloadtxr-a52a10871b45806db86476fc17092368bcc5b1c3.tar.gz
txr-a52a10871b45806db86476fc17092368bcc5b1c3.tar.bz2
txr-a52a10871b45806db86476fc17092368bcc5b1c3.zip
struct: changing meaning of obj.[fun ...] syntax.
Until now, the obj.[fun ...] syntax has uselessly denoted exactly the same thing as [obj.fun ...]. This latter syntax is what should be used for that meaning. The new meaning of obj.[fun ...] will be that it performs method dispatch, where obj is passed to obj.fun as the leftmost argument: obj.[fun ...] is [obj.fun obj ...], with obj evaluated once. * share/txr/stdlib/struct.tl (qref): Expansion change done here, with backward compat switch. * share/txr/stdlib/termios.tl (termios (go-raw, go-cbreak)): Some a.[b c] turned to [a.b c] here. * tests/012/oop.tl (animal print): Likewise. * tests/012/struct.tl: Likewise, and some expansion tests updated to reflect the new expansion. * txr.1: Documentation revised in multiple places and compat note added.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/struct.tl14
-rw-r--r--share/txr/stdlib/termios.tl8
2 files changed, 16 insertions, 6 deletions
diff --git a/share/txr/stdlib/struct.tl b/share/txr/stdlib/struct.tl
index 64cd2e76..2eecfbc7 100644
--- a/share/txr/stdlib/struct.tl
+++ b/share/txr/stdlib/struct.tl
@@ -223,11 +223,21 @@
:))
(((dw sym . args))
(if (eq dw 'dwim)
- ^[(slot ,obj ',(sys:check-slot form sym)) ,*args]
+ (let ((osym (gensym)))
+ (sys:check-slot form sym)
+ ^(slet ((,osym ,obj))
+ ,(if (and (plusp sys:compat) (<= sys:compat 251))
+ ^[(slot ,osym ',sym) ,*args]
+ ^[(slot ,osym ',sym) ,osym ,*args])))
:))
(((dw sym . args) . more)
(if (eq dw 'dwim)
- ^(qref [(slot ,obj ',(sys:check-slot form sym)) ,*args] ,*more)
+ (let ((osym (gensym)))
+ (sys:check-slot form sym)
+ ^(qref (slet ((,osym ,obj))
+ ,(if (and (plusp sys:compat) (<= sys:compat 251))
+ ^[(slot ,osym ',sym) ,*args]
+ ^[(slot ,osym ',sym) ,osym ,*args])) ,*more))
:))
(((sym . args))
(let ((osym (gensym)))
diff --git a/share/txr/stdlib/termios.tl b/share/txr/stdlib/termios.tl
index 93fcc958..5d2423dc 100644
--- a/share/txr/stdlib/termios.tl
+++ b/share/txr/stdlib/termios.tl
@@ -56,15 +56,15 @@
(if (boundp 'iexten)
tio.(clear-lflags iexten))
tio.(set-cflags cs8)
- (set tio.[cc vmin] 1)
- (set tio.[cc vtime] 0))
+ (set [tio.cc vmin] 1)
+ (set [tio.cc vtime] 0))
(defmeth termios go-cbreak (tio)
tio.(clear-iflags icrnl)
tio.(clear-lflags icanon)
tio.(set-lflags isig)
- (set tio.[cc vmin] 1)
- (set tio.[cc vtime] 0))
+ (set [tio.cc vmin] 1)
+ (set [tio.cc vtime] 0))
(defmeth termios string-encode (tio)
(let ((*print-base* 16))