Re: SRFI 105: Curly-infix-expressions David A. Wheeler 29 Aug 2012 00:25 UTC

John Cowan:
> Draft 7 isn't yet published, but soon will be.  Draft 6 is the current
> published draft.

Whups, of course I meant draft 6.

> R6RS says that `equal?` "returns #t if and only if the (possibly
> infinite) unfoldings of its arguments into regular trees are equal as
> ordered trees."  I sort of know what that means, but it isn't the kind
> of thing I'd like to put into a standard.  We have a window in the next
> few days to get better language into draft 7, if you have any on tap.

I have several concerns about cycle-detection in R7RS, which I think is otherwise shaping up pretty nicely.  Trying to deal with equal? led me to realize some weirdnesses with equal?, write, and display.  I'll see what I can do quickly.

> It's not obvious to me why you want to bother with this.  No Scheme I
> know of behaves well in the presence of cycles *in code*, and indeed
> R7RS prohibits them explicitly.  I know that curly-expressions can be
> used outside of code, but I expect (and I think you expect too) that
> code will be their dominant use.

True.  But since it will be used to read data, my concern was protecting the reader.

> I think it's a win to support `equal?`, with or without cycle detection.

Okay, fair enough.

> > > R6RS #!-switch is the closest I can think of that can make a source
> > > file self-descriptive about the lexical syntax it uses.  Did you
> > > think about using something like #!c-expr ?
> >
> > A switch might work, though I think the #! syntax for switches is
> > absurd; the #! sequence is ALREADY reserved by most Unix/Linux
> > systems, and they will not change it for Scheme :-(.
>
> Only as the first two characters of a file.  Putting a blank line before
> a Scheme-specific switch will defeat the Unix interpretation

Fair enough.  But will *Scheme* ignore it properly when it IS the first character of a file? Guile, clisp, and many other Lisps will ignore #!...!# so that you can create Scripts in Scheme / Common Lisp / whatever.  That is really useful functionality, and one that I hate to interfere with.

> (which, by
> the way, is not part of Posix, though quite pervasive in everything but
> Windows).

Yes, I know.  But the POSIX authors' rejection of #! has not exactly prevented its implementation :-).  I use #! all the time.  There's no reason Schemes can't support it, it makes scripting far more pleasurable.

> I think the SRFI should prescribe the switch (say, #!srfi-105),
> since there is no reason why it should be different on different
> implementations.

Okay, adding a switch seems to be strongly advocated, and I'm certainly amenable.  Any preference on the switch name?:
#!srfi-105
#!c-expr
...something else...

--- David A. Wheeler