unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: syntax-local-binding
Date: Mon, 23 Jan 2012 23:19:30 +0100	[thread overview]
Message-ID: <87zkdem58t.fsf@pobox.com> (raw)
In-Reply-To: <87hazmrv15.fsf@netris.org> (Mark H. Weaver's message of "Mon, 23 Jan 2012 16:03:34 -0500")

Hi Mark,

On Mon 23 Jan 2012 22:03, Mark H Weaver <mhw@netris.org> writes:

> Andy Wingo <wingo@pobox.com> writes:
>
>> with identifier-syntax, one can no longer write a code walker with
>> syntax-rules pattern matching, as single identifiers may expand out
>> to complicated expressions, possibly even with side effects.
>
> This is false.  Macros are always expanded _before_ any of their
> arguments are expanded.  Therefore, a code walker sees the unexpanded
> forms, including any "simulated variables" bound by identifier-syntax.

I'm not sure we're talking about the same thing here; do see Alex
Shinn's NAK on R6RS:  http://www.r6rs.org/ratification/results.html#X70

While I disagree with his assessment of the identifier-syntax tradeoff,
I think he correctly identifies it as a tradeoff.

>>>> Why do you think that?  The procedures do carry metadata; I understood
>>>> that that was your strategy, to use the serialization of the
>>>> syntax-rules form in the procedure metadata.
>>>
>>> Well, this was in the context of a new strategy where psyntax would
>>> include a new core form called `call-with-current-local-expander' that
>>> calls its parameter (a procedure or macro) with a procedure that accepts
>>> an expression and returns an expanded form.  In this case, the most
>>> straightforward implementation would simply serialize the (r w mod)
>>> structures directly.
>>>
>>> Toward that end, I was thinking it would be nice to keep those
>>> structures serializable.  The only part that's not currently
>>> serializable are the transformer procedures for local macros.
>>> Thus the change in representation.
>>
>> I have been staring at this empty page here for a little while, writing
>> and re-writing, but I can't get over a feeling that I really don't want
>> this kind of work in psyntax itself.
>
> Your priorities are reversed from what they ought to be.
>
> What you _should_ be worried about is making commitments in our API that
> we must continue to support forever.  This is a _real_ problem, since it
> constrains our ability to modify our implementation in the future.

I know I'm going to sound like Mr. Collins in Pride and Prejudice here,
but I flatter myself that I know a thing or two about managing change --
I mean, replacing the lazy-memoizing evaluator with the compiler,
retrofitting psyntax into Guile, the whole subr mess, etc.  There is
always room to improve, of course, as in all human endeavor, but for now
it does seem that Guile is getting more powerful _and_ more limpid over
time.

But frankly though, regarding change, while we do need the freedom to
modify some things, some other practical freedoms just don't make the
cost/benefit cut, for me.  For example, considering replacing psyntax,
which seems to be in the back of your mind here.  This conservatism is
preventing Guile from adding features.  And we do need features --
local-eval and syntax-parse among them.

> Putting the `the-environment' in psyntax is, at worst, a stylistic
> issue.  Whether it belongs there is a matter of taste, but however
> strongly you may feel about that, it is a purely _internal_
> implementation issue.  The really important thing is that it commits us
> to _nothing_.  There's nothing stopping us from radically reimplementing
> it later.  In particular, there's nothing stopping us from moving it out
> of psyntax later.

Apart from the fact with `the-environment' in psyntax, it's in the
default environment, of course; though with autoloads one can get around
that...

With `the-environment' in a module, in 2.0.4 we could have three
functions added to psyntax:  syntax-local-binding,
syntax-locally-bound-identifiers, and syntax-module.  The first and the
third have precedent in Racket (whose hackers have been able to do
significantly awesome stuff).  The second is strange, but seems OK.  I'm
OK with them.

But what if they're the wrong interface?

Well, then we use the normal deprecation mechanism to get rid of them,
eventually (in the 2.2 series, for example).  We learned something.
Users get warned off the code.  Life goes on.

> Guile has been in existence for a couple of decades already, and I hope
> that it will be actively used for many decades to come.

Hear, hear.

> With that in mind, please consider the long view.  One of the reasons
> Scheme has lasted so long is because it tries exceptionally hard to
> hide internal implementation details.  Implementations that expose too
> much internal detail may derive a short-term benefit from doing so,
> but it comes at the price of eventual calcification: there comes a
> time when implementations that expose too much become unable to make
> significant internal structural changes.
>
> Please consider this.  I feel that your mind has become closed to my
> arguments.

I really do value your work, and your words, Mark.  Besides that
personal appreciation, I think you're doing good work for Guile.

We happen to disagree here on a matter of implementation.  OK.  It's a
feature we have worked on sufficiently that it should probably make it
into 2.0.4.  OK.  One of us will be unhappy about whatever goes in, it
seems.  I appreciate the calcification argument, but I simply think that
it does not apply in this case.

The thing that we shouldn't forget, though, is that regardles of the
particular technique, if local-eval goes in, we'll have won already --
local-eval in a modern Scheme.

Regards,

Andy
-- 
http://wingolog.org/



  reply	other threads:[~2012-01-23 22:19 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-15 17:00 syntax-local-binding Andy Wingo
2012-01-15 17:22 ` syntax-local-binding Andy Wingo
2012-01-19 11:41   ` syntax-local-binding Andy Wingo
2012-01-20 20:26     ` syntax-local-binding Mark H Weaver
2012-01-20 21:23       ` syntax-local-binding Andy Wingo
2012-01-20 22:03         ` syntax-local-binding Mark H Weaver
2012-01-22  0:03           ` syntax-local-binding Ludovic Courtès
2012-01-23 16:05           ` syntax-local-binding Andy Wingo
2012-01-23 21:03             ` syntax-local-binding Mark H Weaver
2012-01-23 22:19               ` Andy Wingo [this message]
2012-01-24  2:11                 ` syntax-local-binding Mark H Weaver
2012-01-24 11:42                   ` syntax-local-binding Andy Wingo
2012-01-24 17:29                     ` syntax-local-binding Noah Lavine
2012-01-24 10:30                 ` syntax-local-binding Peter TB Brett
2012-01-24 10:38                   ` syntax-local-binding David Kastrup
2012-01-24 11:26                   ` syntax-local-binding Andy Wingo
2012-01-24 13:25                     ` syntax-local-binding Mark H Weaver
2012-01-24 20:28                       ` mark uniqueness (Was: Re: syntax-local-binding) Andy Wingo
2012-01-25  0:26                         ` mark uniqueness Mark H Weaver
2012-01-25  9:02                           ` Andy Wingo
2012-01-24 21:22                       ` syntax-local-binding Andy Wingo
2012-01-25  2:30                         ` syntax-local-binding Mark H Weaver
2012-01-25  7:49                           ` syntax-local-binding Stefan Israelsson Tampe
2012-01-25 11:18                           ` syntax-local-binding Andy Wingo
2012-01-25 13:18                           ` syntax-local-binding Ludovic Courtès
2012-01-25 18:08                             ` syntax-local-binding Mark H Weaver
2012-01-26 11:21                             ` syntax-local-binding 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=87zkdem58t.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=mhw@netris.org \
    /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).