Permalink
Browse files

Replace "cmethod" and "imethod" with "+" and "-".

I have come to prefer these because they are more consistent with Objective-C.
I would like to deprecate/eliminate cmethod/imethod.
  • Loading branch information...
1 parent 237bf3b commit 045f219bfa36fd15f8914a42925f394c36f5819f Tim Burks committed Oct 19, 2010
View
@@ -6,31 +6,31 @@
(class TestBlockArgs is NuTestCase
- (imethod (id) testSimpleArgs is
- (function make-list (a b c)
- (list a b c))
- (assert_equal '(1 2 3) (make-list 1 2 3)))
+ (- (id) testSimpleArgs is
+ (function make-list (a b c)
+ (list a b c))
+ (assert_equal '(1 2 3) (make-list 1 2 3)))
- (imethod (id) testRestArgs is
- (function make-list (a b *rest)
- (append (list a b) *rest))
- (assert_equal '(1 2 3) (make-list 1 2 3))
- (assert_equal '(1 2 3 4 5) (make-list 1 2 3 4 5)))
+ (- (id) testRestArgs is
+ (function make-list (a b *rest)
+ (append (list a b) *rest))
+ (assert_equal '(1 2 3) (make-list 1 2 3))
+ (assert_equal '(1 2 3 4 5) (make-list 1 2 3 4 5)))
- (imethod (id) testOverrideImplicitArgs1 is
- (function make-list (*args)
- (*args))
- (assert_equal '(1 2 3) (make-list 1 2 3))
- (assert_equal '() (make-list)))
+ (- (id) testOverrideImplicitArgs1 is
+ (function make-list (*args)
+ (*args))
+ (assert_equal '(1 2 3) (make-list 1 2 3))
+ (assert_equal '() (make-list)))
- (imethod (id) testOverrideImplicitArgs2 is
- (function make-list (a b *args)
- (list a b *args))
- (assert_equal '(1 2 ()) (make-list 1 2))
- (assert_equal '(1 2 (3)) (make-list 1 2 3)))
-
- (imethod (id) testBlock is
- (assert_equal '(1 2) ((do (a b) (list a b)) 1 2))
- (assert_equal '(1 2) ((do (a b *args) (list a b)) 1 2 3 4))
- (assert_equal '(3 4) ((do (a b *args) (*args)) 1 2 3 4))
- (assert_equal '(1 (3 4)) ((do (a b *args) (list a *args)) 1 2 3 4))))
+ (- (id) testOverrideImplicitArgs2 is
+ (function make-list (a b *args)
+ (list a b *args))
+ (assert_equal '(1 2 ()) (make-list 1 2))
+ (assert_equal '(1 2 (3)) (make-list 1 2 3)))
+
+ (- (id) testBlock is
+ (assert_equal '(1 2) ((do (a b) (list a b)) 1 2))
+ (assert_equal '(1 2) ((do (a b *args) (list a b)) 1 2 3 4))
+ (assert_equal '(3 4) ((do (a b *args) (*args)) 1 2 3 4))
+ (assert_equal '(1 (3 4)) ((do (a b *args) (list a *args)) 1 2 3 4))))
View
@@ -5,18 +5,18 @@
(class TestBridge is NuTestCase
(if (eq (uname) "Darwin")
- (imethod (id) testConstants is
- (set floatTypeSignature (if (eq (Nu sizeOfPointer) 8) (then "d") (else "f")))
- (assert_equal 0 (NuBridgedConstant constantWithName:"NSBlack" signature:floatTypeSignature))
- (assert_equal 1 (NuBridgedConstant constantWithName:"NSWhite" signature:floatTypeSignature))
- (assert_equal '(0 0 0 0) (NuBridgedConstant constantWithName:"NSZeroRect" signature:"{_NSRect}"))
- (assert_equal (NSApplication sharedApplication) (NuBridgedConstant constantWithName:"NSApp" signature:"@"))))
+ (- (id) testConstants is
+ (set floatTypeSignature (if (eq (Nu sizeOfPointer) 8) (then "d") (else "f")))
+ (assert_equal 0 (NuBridgedConstant constantWithName:"NSBlack" signature:floatTypeSignature))
+ (assert_equal 1 (NuBridgedConstant constantWithName:"NSWhite" signature:floatTypeSignature))
+ (assert_equal '(0 0 0 0) (NuBridgedConstant constantWithName:"NSZeroRect" signature:"{_NSRect}"))
+ (assert_equal (NSApplication sharedApplication) (NuBridgedConstant constantWithName:"NSApp" signature:"@"))))
- (imethod (id) testFunctions is
- (set strcmp (NuBridgedFunction functionWithName:"strcmp" signature:"i**"))
- (assert_less_than 0 (strcmp "a" "b"))
- (assert_equal 0 (strcmp "b" "b"))
- (assert_greater_than 0 (strcmp "c" "b"))
- (set pow (NuBridgedFunction functionWithName:"pow" signature:"ddd"))
- (assert_equal 8 (pow 2 3))))
+ (- (id) testFunctions is
+ (set strcmp (NuBridgedFunction functionWithName:"strcmp" signature:"i**"))
+ (assert_less_than 0 (strcmp "a" "b"))
+ (assert_equal 0 (strcmp "b" "b"))
+ (assert_greater_than 0 (strcmp "c" "b"))
+ (set pow (NuBridgedFunction functionWithName:"pow" signature:"ddd"))
+ (assert_equal 8 (pow 2 3))))
View
@@ -8,12 +8,12 @@
(class TestBridgeSupport is NuTestCase
- (imethod (id) testConstants is
- (assert_equal "NSFileBusy" NSFileBusy))
+ (- (id) testConstants is
+ (assert_equal "NSFileBusy" NSFileBusy))
- (imethod (id) testEnums is
- (assert_equal 4 NSGreaterThanComparison))
+ (- (id) testEnums is
+ (assert_equal 4 NSGreaterThanComparison))
(unless ((NSGarbageCollector defaultCollector) isEnabled)
- (imethod (id) testFunctions is
- (assert_equal 2 (NSMinY '(1 2 3 4)))))))
+ (- (id) testFunctions is
+ (assert_equal 2 (NSMinY '(1 2 3 4)))))))
View
@@ -5,51 +5,51 @@
(class TestCharacters is NuTestCase
- (imethod (id) testRegularCharacters is
- (set a 'a')
- (set Z 'Z')
- (set LPAREN '(')
- (set RPAREN ')')
- (set SEMICOLON ';')
- (set HASH '#')
- (set golden "aZ();#")
- (assert_equal (golden characterAtIndex:0) a)
- (assert_equal (golden characterAtIndex:1) Z)
- (assert_equal (golden characterAtIndex:2) LPAREN)
- (assert_equal (golden characterAtIndex:3) RPAREN)
- (assert_equal (golden characterAtIndex:4) SEMICOLON)
- (assert_equal (golden characterAtIndex:5) HASH))
+ (- (id) testRegularCharacters is
+ (set a 'a')
+ (set Z 'Z')
+ (set LPAREN '(')
+ (set RPAREN ')')
+ (set SEMICOLON ';')
+ (set HASH '#')
+ (set golden "aZ();#")
+ (assert_equal (golden characterAtIndex:0) a)
+ (assert_equal (golden characterAtIndex:1) Z)
+ (assert_equal (golden characterAtIndex:2) LPAREN)
+ (assert_equal (golden characterAtIndex:3) RPAREN)
+ (assert_equal (golden characterAtIndex:4) SEMICOLON)
+ (assert_equal (golden characterAtIndex:5) HASH))
- (imethod (id) testEscapedCharacters is
- (assert_equal 10 '\n')
- (assert_equal 13 '\r')
- (assert_equal 12 '\f')
- (assert_equal 8 '\b')
- (assert_equal 7 '\a')
- (assert_equal 27 '\e')
- (assert_equal 32 '\s'))
+ (- (id) testEscapedCharacters is
+ (assert_equal 10 '\n')
+ (assert_equal 13 '\r')
+ (assert_equal 12 '\f')
+ (assert_equal 8 '\b')
+ (assert_equal 7 '\a')
+ (assert_equal 27 '\e')
+ (assert_equal 32 '\s'))
- (imethod (id) testOctalEscapedCharacters is
- (if (eq (uname) "Darwin") ;; requires UTF-8
- (assert_equal 0 '\000'))
- (assert_equal 1 '\001')
- (assert_equal 255 '\377'))
+ (- (id) testOctalEscapedCharacters is
+ (if (eq (uname) "Darwin") ;; requires UTF-8
+ (assert_equal 0 '\000'))
+ (assert_equal 1 '\001')
+ (assert_equal 255 '\377'))
- (imethod (id) testHexEscapedCharacters is
- (if (eq (uname) "Darwin") ;; requires UTF-8
- (assert_equal 0 '\x00'))
- (assert_equal 1 '\x01')
- (assert_equal 255 '\xfF'))
+ (- (id) testHexEscapedCharacters is
+ (if (eq (uname) "Darwin") ;; requires UTF-8
+ (assert_equal 0 '\x00'))
+ (assert_equal 1 '\x01')
+ (assert_equal 255 '\xfF'))
(if (eq (uname) "Darwin") ;; requires UTF-8
- (imethod (id) testUnicodeEscapedCharacters is
- (assert_equal 0 '\u0000')
- (assert_equal 1 '\u0001')
- (assert_equal 65535 '\uFfFf')
- (assert_equal 255 '\u00ff')))
+ (- (id) testUnicodeEscapedCharacters is
+ (assert_equal 0 '\u0000')
+ (assert_equal 1 '\u0001')
+ (assert_equal 65535 '\uFfFf')
+ (assert_equal 255 '\u00ff')))
- (imethod (id) testFourCharacterIntegers is
- (assert_equal 1886604404 'psLt')
- (assert_equal 1886601524 'psA4')))
+ (- (id) testFourCharacterIntegers is
+ (assert_equal 1886604404 'psLt')
+ (assert_equal 1886601524 'psA4')))
View
@@ -9,30 +9,30 @@
(class TestClosures is NuTestCase
- (imethod (id) testAccumulator is
- ;; The accumulator function from Paul Graham's
- ;; "Revenge of the Nerds", http://www.paulgraham.com/icad.html
- (function make-accumulator (n)
- (do (i) (set n (+ n i))))
- (set accumulator (make-accumulator 0))
- (assert_equal 1 (accumulator 1))
- (assert_equal 3 (accumulator 2))
- (assert_equal 6 (accumulator 3))
- (set accumulator (make-accumulator 5))
- (assert_equal 6 (accumulator 1))
- (assert_equal 8 (accumulator 2))
- (assert_equal 11 (accumulator 3)))
+ (- (id) testAccumulator is
+ ;; The accumulator function from Paul Graham's
+ ;; "Revenge of the Nerds", http://www.paulgraham.com/icad.html
+ (function make-accumulator (n)
+ (do (i) (set n (+ n i))))
+ (set accumulator (make-accumulator 0))
+ (assert_equal 1 (accumulator 1))
+ (assert_equal 3 (accumulator 2))
+ (assert_equal 6 (accumulator 3))
+ (set accumulator (make-accumulator 5))
+ (assert_equal 6 (accumulator 1))
+ (assert_equal 8 (accumulator 2))
+ (assert_equal 11 (accumulator 3)))
- (imethod (id) testScoping is
- (set x 0)
- ;; Here we redefine x inside the let context, so
- ;; assignments to x in the block do not affect the outer x
- (10 times: (do (i) (let ((x x)) (set x (+ x 1)))))
- (assert_equal 0 x)
- ;; Here we refer to the outer binding of x, so
- ;; assignments to x in the block do affect the outer x
- (10 times: (do (i) (set x (+ x 1)) (set y x)))
- (assert_equal 10 x)
- (assert_equal 10 ((context) objectForKey:'x))
- ;; but assignments to y are invisible in the outer context
- (assert_equal nil ((context) objectForKey:'y))))
+ (- (id) testScoping is
+ (set x 0)
+ ;; Here we redefine x inside the let context, so
+ ;; assignments to x in the block do not affect the outer x
+ (10 times: (do (i) (let ((x x)) (set x (+ x 1)))))
+ (assert_equal 0 x)
+ ;; Here we refer to the outer binding of x, so
+ ;; assignments to x in the block do affect the outer x
+ (10 times: (do (i) (set x (+ x 1)) (set y x)))
+ (assert_equal 10 x)
+ (assert_equal 10 ((context) objectForKey:'x))
+ ;; but assignments to y are invisible in the outer context
+ (assert_equal nil ((context) objectForKey:'y))))
Oops, something went wrong.

0 comments on commit 045f219

Please sign in to comment.