diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-02-09 07:45:05 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-02-09 07:45:05 -0800 |
commit | a52a10871b45806db86476fc17092368bcc5b1c3 (patch) | |
tree | e03fdd4f1ed7dd123fb3e55f4c23ecbae17c2c71 /tests | |
parent | a824ded1de5099e860e119bec1d3a2ed5e12a1ba (diff) | |
download | txr-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 'tests')
-rw-r--r-- | tests/012/oop.tl | 2 | ||||
-rw-r--r-- | tests/012/struct.tl | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/012/oop.tl b/tests/012/oop.tl index 51dadbf3..ac93790f 100644 --- a/tests/012/oop.tl +++ b/tests/012/oop.tl @@ -2,7 +2,7 @@ (defstruct animal nil (:function whoami () "n/a") - (:method print (self stream : pretty-p) (put-string self.[whoami] stream))) + (:method print (self stream : pretty-p) (put-string [self.whoami] stream))) (defstruct dog animal (:function whoami () "dog")) diff --git a/tests/012/struct.tl b/tests/012/struct.tl index 9de3f832..88f37e4d 100644 --- a/tests/012/struct.tl +++ b/tests/012/struct.tl @@ -31,9 +31,9 @@ (test (expand 's.a) (slot s 'a)) (test (expand 's.[a]) - [(slot s 'a)]) + [(slot s 'a) s]) (test (expand 's.[a b c]) - [(slot s 'a) b c]) + [(slot s 'a) s b c]) (set *gensym-counter* 0) (stest (ignwarn (expand 's.(a))) @@ -44,9 +44,9 @@ "(call (slot s 'a)\n \ \ s b c)") (test (expand 's.[a].d) - (slot [(slot s 'a)] 'd)) + (slot [(slot s 'a) s] 'd)) (test (expand 's.[a b c].d) - (slot [(slot s 'a) b c] 'd)) + (slot [(slot s 'a) s b c] 'd)) (set *gensym-counter* 0) (stest (ignwarn (expand 's.(a).d)) "(slot (call (slot s 'a)\n \ @@ -104,7 +104,7 @@ (stest bz "#S(baz array #(1 2 3) increment #<interpreted fun: lambda (self which delta)>)") -(test bz.[array 2] 3) +(test [bz.array 2] 3) (test bz.(increment 0 42) 43) (test bz.array #(43 2 3)) (test [(meth bz increment) 1 5] 7) |