[gambit-list] Thoughts on Scheme

Mikael mikael.rcv at gmail.com
Fri Jan 11 11:25:11 EST 2013


2013/1/5 Meng Zhang <wsxiaoys.lh at gmail.com>

> While talking about the syntactic-closures, If we ignore syntax-case, I'll
> disagree that it brings "incredible" complexity. I've been uncertain
> on syntactic-closures for years [..] I found
> the concept of it is quite straight forward.
>

2013/1/6 Álvaro Castro-Castilla <alvaro.castro.castilla at gmail.com>

> I agree with Meng.
> I see syntax-rules as a DSL for hygienic macros. It is completely
> "schemey" in the same way libraries like Kanren for logic programming, or
> FrTime for reactive programming are. The only difference is that when using
> hygienic macros, your code becomes data as well, to be processed before it
> actually turns into code.
>

Meng and Alvaro, ah, note taken, to have a clearer take on them personally,
I'd need some serious experience of using them, and until now I did not
really dig into them that much personally.


It's really unfortunate, in a sense, that in a hybrid S.C. and define-macro
environment, that any use in define-macro of symbol? or any kind of symbol
inspection or comparison, easly becomes *Completely Messed*.

Here's a mild example:

(define-macro (debug-print . a)
   (for-each (lambda (e) (cond ((symbol? e) (print "'" (symbol->string e) "
"))
                               ((string? e) (print e " "))
                               (else (write e) (print " ")))) a))

(debug-print 5 + 7 "\n")


What is printed in the place of "+" depends on the particular grace of the
SC macros loaded and the expander in this moment and instance.

It could |write| any expander-internal structure really, with any amount of
object dependencies.

Now this was a really basic example, if some more extensive one comes to
your mind feel free to share.


Meng:

> Though I deadly missed an easy-to-understand, concrete implementation
> with document for it during the learning process.
>

Yes! Like, a complete reference of Scheme macro systems: How to use them,
strengths and limitations, how to implement them on their own and in hybrid
forms, and what the challenges are, including illustrative examples.

This would do well as a downloadable PDF book.


Alvaro:

>  Actually, when you take into account a couple of pitfalls regarding
> lexical scoping and shadowing and use a variety of techniques, including
> continuation-passing-style, writing syntax-rules macros are extremely
> powerful and similar to regular recursive scheme.
>

Can you give any code examples of use of this variety of techniques for
writing extremely powerful syntax-rules macros?


2013/1/8 Hendrik Boom <hendrik at topoi.pooq.com>

> On Mon, Jan 07, 2013 at 10:37:08AM -0500, Jason Felice wrote:
> ...
> ...
> > I don't think efficiency in terms of constant factors should often win
> > versus code which could be more general.   Clearly this is a value
> choice;
> > however, I wonder how well a compiler can eliminate type dispatching
> > without adding type annotation to the language.
>
> For me, the value of type anotations is the possibility of static type
> checking, which catches bugs fast.  That the compiler can then use the
> information to generate better code is a pleasant freebie.
>
> It would be interesting to see if the stragegy in, say, typed Racket,
> could be usefully adapted to Gambit.
>

Yes, type annotations that catch bugs already at expand time would be of
value.

The abstract interpreter might not catch all at compile time of course,
but, really enough. I'd be curious to know what kind of performance such a
solution would have .. I wonder what Might published recently.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130111/2248083f/attachment.htm>


More information about the Gambit-list mailing list