This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: (eval '(java.lang.System:nanoTime)) won't work
- From: Morven Sun <sunixm at gmail dot com>
- To: Per Bothner <per at bothner dot com>, kawa at sourceware dot org
- Date: Sun, 9 Jun 2013 16:38:55 +0800
- Subject: Re: (eval '(java.lang.System:nanoTime)) won't work
- References: <CAKZUWfh6SexU3=Y8sch_BAfERoA4Agn8pOmDZTep9cynmgzmUA at mail dot gmail dot com> <51B42DD2 dot 7050406 at bothner dot com>
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? :)