unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* sc-expand on syntax-case form
@ 2009-02-23  1:13 Julian Graham
  2009-02-27 16:42 ` Julian Graham
  0 siblings, 1 reply; 3+ messages in thread
From: Julian Graham @ 2009-02-23  1:13 UTC (permalink / raw)
  To: guile-user

Hi Guilers,

Is sc-expand in `(ice-9 syncase)' supposed to be able to expand the
syntax-case form?  When I try to run it on an expression that includes
a syntax-case form that looks like:

  (syntax-case foo () ... )

...I get "invalid syntax ()", presumably because () isn't valid Scheme
syntax outside of some well-known special forms -- does this style of
syntax-case need to be added to sc-expand's list of acceptable syntax?
 PLT's version of the syntax-case expander (`expand') doesn't seem to
have any trouble with this.  For what it's worth, in Guile:

  (sc-expand '(lambda () (quote ())))

produces

  (lambda () (quote ()))

...while

  (sc-expand '(let () (quote ())))

produces

  (quote ())

That last one strikes me as a little weird.


Regards,
Julian




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sc-expand on syntax-case form
  2009-02-23  1:13 sc-expand on syntax-case form Julian Graham
@ 2009-02-27 16:42 ` Julian Graham
  2009-03-02 21:40   ` Neil Jerram
  0 siblings, 1 reply; 3+ messages in thread
From: Julian Graham @ 2009-02-27 16:42 UTC (permalink / raw)
  To: guile-user

Okay, I think I've (tentatively) figured this one out:

Instead of `sc-expand', the proper function to use is `syncase'.  (And
you can use `save-module-excursion' if expansion needs to happen with
regard to a particular module environment.)


On Sun, Feb 22, 2009 at 8:13 PM, Julian Graham <joolean@gmail.com> wrote:
> Hi Guilers,
>
> Is sc-expand in `(ice-9 syncase)' supposed to be able to expand the
> syntax-case form?  When I try to run it on an expression that includes
> a syntax-case form that looks like:
>
>  (syntax-case foo () ... )
>
> ...I get "invalid syntax ()", presumably because () isn't valid Scheme
> syntax outside of some well-known special forms -- does this style of
> syntax-case need to be added to sc-expand's list of acceptable syntax?
>  PLT's version of the syntax-case expander (`expand') doesn't seem to
> have any trouble with this.  For what it's worth, in Guile:
>
>  (sc-expand '(lambda () (quote ())))
>
> produces
>
>  (lambda () (quote ()))
>
> ...while
>
>  (sc-expand '(let () (quote ())))
>
> produces
>
>  (quote ())
>
> That last one strikes me as a little weird.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sc-expand on syntax-case form
  2009-02-27 16:42 ` Julian Graham
@ 2009-03-02 21:40   ` Neil Jerram
  0 siblings, 0 replies; 3+ messages in thread
From: Neil Jerram @ 2009-03-02 21:40 UTC (permalink / raw)
  To: Julian Graham; +Cc: guile-user

Julian Graham <joolean@gmail.com> writes:

> Okay, I think I've (tentatively) figured this one out:
>
> Instead of `sc-expand', the proper function to use is `syncase'.  (And
> you can use `save-module-excursion' if expansion needs to happen with
> regard to a particular module environment.)

Hi Julian,

Just to comment a bit, although I really don't understand syncase
well...

Using `syncase' rather than `sc-expand' sounds right to me.  Guile's
`use-syntax' hack requires the transformer producer to have the same
name as the module that defines it, so it's expected that `syncase' is
the top-level transformer.

Regards,
        Neil




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-02 21:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-23  1:13 sc-expand on syntax-case form Julian Graham
2009-02-27 16:42 ` Julian Graham
2009-03-02 21:40   ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).