unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: mikael@djurfeldt.com, guile-devel@gnu.org
Subject: Re: Fixing the slib mess
Date: Mon, 22 Oct 2012 20:31:20 +0200	[thread overview]
Message-ID: <CAGua6m1dLXqNPkQ87sjjk7Pd9En2AdidXB7LRVJfH5fq0mTw_Q@mail.gmail.com> (raw)
In-Reply-To: <CAA2XvwKDtWW7ryQ8rLoaLekNtyLpLaHOs4U_qF7Coy+VkJ-xPg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1514 bytes --]

Hi Mikael and welcome back!


*But*, the proper implementation of syntax-toplevel? requires
> modification of psyntax.scm and adding it to the (system syntax)
> module.  I didn't want to do this until I've had your comments, so the
> present patch has its own syntax-object accessors (which breaks
> abstraction and is therefore not a real solution).  I should also say
> that I have not yet fixed the slib interface to the new Guile uniform
> arrays, so there's a lot of slib functionality which won't yet work.
>
> Comments?  Can I add syntax-toplevel? to psyntax.scm and (system
> syntax)?  Do you think it is reasonable to submit something along the
> line of guile.init.diff to slib guile.init?
>
> Best regards,
> Mikael Djurfeldt
>

I can answer with some kind of suggestion here.

in (system syntax) there is syntax-local-binding which you can use for
example as


(define-syntax f
  (lambda (x)
    (syntax-case x ()
      ((_ x)
        (call-with-values (lambda () (syntax-local-binding #'x))
                                (lambda (x y) (pk x) (pk y))) #'#t))))

Then,

scheme@(guile-user) [1]> (f +)

;;; (global)

;;; ((+ guile-user))

And,

scheme@(guile-user) [1]> (let ((s 1)) (f s))

;;; (lexical)

;;; (s-490)

(let ((s 1)) (define-syntax g (lambda (x) #'#f)) (f g))

;;; (displaced-lexical)

;;; (#f)

I'm not sure what exactly syntax-toplevel? does, but can you base it on
syntax-local-binding?
And if not is it possible to change syntax-local-binding so that you can
use it?

Regards
Stefan

[-- Attachment #2: Type: text/html, Size: 1888 bytes --]

  reply	other threads:[~2012-10-22 18:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-21 23:11 Fixing the slib mess Mikael Djurfeldt
2012-10-22 18:31 ` Stefan Israelsson Tampe [this message]
2012-10-22 19:11   ` Mikael Djurfeldt
2012-10-22 19:33     ` Stefan Israelsson Tampe
2012-10-22 20:00 ` Mikael Djurfeldt
2012-10-22 21:51 ` Mark H Weaver
2012-10-23  8:23   ` Mikael Djurfeldt
2012-10-23 18:01     ` Mark H Weaver
2012-10-23 22:23       ` Mikael Djurfeldt
2012-11-01  5:25         ` Mark H Weaver
2013-01-21 17:58 ` Andy Wingo
2013-01-21 18:09   ` Mikael Djurfeldt
2013-01-21 19:04     ` Andy Wingo

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=CAGua6m1dLXqNPkQ87sjjk7Pd9En2AdidXB7LRVJfH5fq0mTw_Q@mail.gmail.com \
    --to=stefan.itampe@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=mikael@djurfeldt.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).