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]

Re: (eval '(java.lang.System:nanoTime)) won't work


2013/6/9 Per Bothner <per@bothner.com>:
> On 06/09/2013 12:04 AM, Morven Sun wrote:
>
> This is a problem because Kawa tries to support both "colon notation":
>
> http://www.gnu.org/software/kawa/Colon-notation.html
>

I've read that.

> and also tries to run programs written for other Scheme implementations
> where colon is just a constituent of a symbol.  This is a bit of a
> kludge, and the biggest problem is with quoted forms.
>
> Not sure what the best solution is.
> --

I now know the reason. With the problem like this the Kawa language
itself seems a little inconsistent.

Scheme is pure though procedureless. :) with great uniform syntax and meanings.

The colon notation is a good extension for bringing lots of
functionality to scheme.

But the problem with eval and quoted form, I think Kawa break the
basic compatibility with Scheme.

----------------

Here I want to define a macro to display every thing to output, I do
it like this:

(define-syntax println
    (syntax-rules ()
        ((println x ...)
            (map display '(x ...)))))

With this macro I can do primitive print like:
     (println 1 2 3)  => 1 2 3
But when come into :
     (println 1 2 (+ 2 3 4)) => 1 2 (+ 2 3 4)
If i want to make (+ 2 3 4) evaluated, I can redefine the macro:

(define-syntax println
    (syntax-rules ()
        ((println x ...)
            (map (lambda (y) (display (eval y))) '(x ...)))))

It's ok with normal scheme variables, but when the colon notation
comes into view, things're just broken.
It's frustrated.

Perhaps the macro I defined is not quite correct. So what's the much
smarter macro would be like? :)


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