[racket-dev] match syntax-parse

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri May 11 12:59:41 EDT 2012

On May 11, 2012, at 9:45 AM, stefan.israelsson at se.abb.com wrote:

> 1. Ported syntax-parse over to guile. 
> 2. Implemented racket's match completely with the help of syntax parse. 

This is really good to hear. 

> Comments about 1. 
> i propose instead to add syntax-class-set! and syntax-splicing-class-set! that has the following logic: 

"set!" is a means to implement recursion but it is an ugly sledge hammer. Instead of hitting the nail, you are sooner or later going to flatten your thumb with it. 

letrec or compound-unit fit the bill better than class-set! because they bring across the intent of declaring mutually recursion entities, possibly located in distinct files. 

So while I welcome the idea, I think we should find a better way to express it. 

> 2. 
> I must say that syntax-parse rocks

It does. 

> and I would suggest that we implement the racket matcher completely with syntax parse. 

I usually argue for clarity of code over speed. BUT we must pay attention to performance, especially widely used features. 

Have you measure the performance of the two versions? Indeed you really need to measure the performance impact of ripping out match from syntax-parse and of implementing match via syntax-parse. It doesn't seem a straightforward case for one or the other. 

-- Matthias

Posted on the dev mailing list.