From a52a10871b45806db86476fc17092368bcc5b1c3 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 9 Feb 2021 07:45:05 -0800 Subject: 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. --- tests/012/struct.tl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/012/struct.tl') 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 #)") -(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) -- cgit v1.2.3