Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Scheme Programming Language

Syntax rationale for (*-syntax) forms


I am rather new to scheme here, but I find this a rather uneasy point:
all the let-syntax, define-syntax etc. uses the form (syntax-rules...)
for definition. My question is why was this chosen to be the
definition language? I mean, wouldn't it save me a few keystrokes if I
could directly specify the transformation like:
(define-syntax (mymacro param1 param2)
  (if (> param1 0) param2 #f)
  (...) ... )  ; Other syntaxes

Not that its biting me too much, but still, why was the 'syntax-rules'
part chosen to be a part of the spec? The only thing I can think of is
that, maybe, I could specify my own constructs there in place of
'syntax-rules' that would allow let-, define-syntax etc. to work with
my own template language. If that is the case, how do I make such a
construct?

Reasamp

Reasamp skrev:

> I am rather new to scheme here, but I find this a rather uneasy point:
> all the let-syntax, define-syntax etc. uses the form (syntax-rules...)
> for definition. My question is why was this chosen to be the
> definition language? I mean, wouldn't it save me a few keystrokes if I
> could directly specify the transformation like:
> (define-syntax (mymacro param1 param2)
>   (if (> param1 0) param2 #f)
>   (...) ... )  ; Other syntaxes

> Not that its biting me too much, but still, why was the 'syntax-rules'
> part chosen to be a part of the spec? The only thing I can think of is
> that, maybe, I could specify my own constructs there in place of
> 'syntax-rules' that would allow let-, define-syntax etc. to work with
> my own template language. If that is the case, how do I make such a
> construct?

The syntax (define-syntax name transformer-specification) associates
the name with a macro transformer. The only in R5RS to specify a
syntax transformer is via syntax-rules. However many implementations
have extensions to R5RS that allow the specification of macro
transformer via other means. One example is syntax-case, which
is in wide use - and (a version of it) part of R6RS.

--
Jens Axel Sgaard

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc