[gambit-list] Thoughts on Scheme

Álvaro Castro-Castilla alvaro.castro.castilla at gmail.com
Sat Jan 12 05:20:05 EST 2013


I've been planning to write an extense document about syntax-rules, since
there is a variety of techniques that aren't documented anywhere except in
the mailing lists or usenet groups. Actually, you can even write unhygienic
macros using syntax-rules, but that's a whole different story (and the
paper describing the technique is 15 pages showing you how to break the
system).

I'll try to write that document as soon as possible!


On Fri, Jan 11, 2013 at 5:25 PM, Mikael <mikael.rcv at gmail.com> wrote:

>
> 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/20130112/31912812/attachment.htm>


More information about the Gambit-list mailing list