This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Question about mac-test and bug #22357
- From: Yaroslav Kavenchuk <kavenchuk at gmail dot com>
- To: kawa at sourceware dot org
- Date: Mon, 18 Jan 2010 13:45:55 +0200
- Subject: Question about mac-test and bug #22357
Hi, All!
I see in mac-test.scm next lines:
(begin ;; Test that we can define and use a syntax-case macro in same
module.
(define-syntax local-defmac-or
(lambda (x)
(syntax-case x ()
((_) (syntax #f))
((_ e) (syntax e))
((_ e1 e2 e3 ...)
(syntax
(let ((t e1)) (if t t (local-defmac-or e2 e3 ...))))))))
(test 4 'local-defmac-or (local-defmac-or #f 4 5)))
It's works fine!
Well, how to rewrite my code from bug #22357:
(define (getNameFromClassPath sName :: String) :: String
(let* ((sLiteralName :: String
(if (and (sName:startsWith "<")
(sName:endsWith ">"))
(sName:substring 1 (- (sName:length) 1))
sName))
(pPos :: int (sLiteralName:lastIndexOf ".")))
(if (>= pPos 0)
(sLiteralName:substring (+ 1 (sLiteralName:lastIndexOf ".")))
sLiteralName)))
(define-syntax import-class
(lambda (form)
(syntax-case form (with-array)
((_ name)
#`(define-namespace ,(string->symbol
(getNameFromClassPath
(symbol->string (syntax-object->datum
#'name))))
name)))))
(import-class gnu.math.IntNum)
if it possible, of cource.
Many thanks!
--
WBR, Yaroslav Kavenchuk