unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Ian Price <ianprice90@googlemail.com>
To: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: syntax-local-value patch for discussion
Date: Thu, 08 Dec 2011 21:58:01 +0000	[thread overview]
Message-ID: <87ty5aafpy.fsf@Kagami.home> (raw)
In-Reply-To: <CAGua6m0syo=-jz9rxfcPr4NTuirRPFevZ89wHKVF_zi3OAgbig@mail.gmail.com> (Stefan Israelsson Tampe's message of "Mon, 5 Dec 2011 19:12:28 +0100")

Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:

> So I tried to get hold of the macro binding. So with the following patch wich should be enogh
> for me to make progress porting rackets syntax parse to guile.
>
> Would be very glad if we could find a interface to expose this information that is sane
> and rigid manner. So we should discuss this feature.
As it stands, I agree it is pretty simplistic, but I'm not sure what to
propose :) What is the intended use cases for this? A compile-time
values mechanism?

> Anyway about the patch.
> I added a fluid that is setted with a closure that captures enough syntax information
> so that we can lookup the macro value local or global. It basically uses the same method
> as psyntax macroexpander.
The patch looks fine to me, although I admit I have little experience
with psyntax.

>
> Now we can write,
> (define-syntax info
>   (lambda (x)
>     (syntax-case x ()
>       ((_ x)
>         (pk (syntax-binding-info (syntax->datum #'x)))
>         #'#f))))
FWIW, I wouldn't expect to have to pass a raw datum to any procedure
with a syntax prefix. If we keep this procedure, I think the
syntax->datum should be hid, or the procedure renamed.

> So with this I can attach meta information to macros local or not by
> using a weak hash.
I have 'define-type' & 'type-case' macros, basically copied from
racket's plai language[0][1] , that suffers from a complete lack of
error handling in the case where the type-id is not, in fact, a
type-id. If I were to use this mechanism, I would create a weak hash of
datatype-ids, adding them to the hash with 'define-type', and checking
if they are in the hash in my 'type-case' macro. Would that be right?

0. http://docs.racket-lang.org/plai/plai-scheme.html
1. I can post these if people want them
-- 
Ian Price

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"



  reply	other threads:[~2011-12-08 21:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05 18:12 syntax-local-value patch for discussion Stefan Israelsson Tampe
2011-12-08 21:58 ` Ian Price [this message]
2011-12-09 11:49   ` Stefan Israelsson Tampe
2012-01-07  0:05 ` Andy Wingo
2012-01-08 17:47   ` Stefan Israelsson Tampe
2012-01-08 19:15 ` Mark H Weaver
2012-01-08 21:28   ` Stefan Israelsson Tampe
2012-01-14 16:42   ` Stefan Israelsson Tampe
2012-01-19  9:50     ` Stefan Israelsson Tampe
2012-01-23 10:53       ` Andy Wingo
2012-01-23 16:06         ` Stefan Israelsson Tampe
2012-01-26 11:31           ` Andy Wingo
2012-01-26 15:49             ` Stefan Israelsson Tampe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ty5aafpy.fsf@Kagami.home \
    --to=ianprice90@googlemail.com \
    --cc=guile-devel@gnu.org \
    --cc=stefan.itampe@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).