This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]