[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SRFI 105: Curly-infix-expressions

This page is part of the web mail archives of SRFI 105 from before July 7th, 2015. The new archives for SRFI 105 contain all messages, not just those from before July 7th, 2015.

David A. Wheeler scripsit:

> It'd be easy for it to *say* "equal?", and recommend checking for
> cycles.  That does complicate the implementation slightly, though not
> badly. R6RS, and R7RS draft 7, have equal? check for cycles but don't
> say what happens if there ARE cycles :-(, which makes it hard to use
> portably.

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

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.

> For portability the sample implementation would probably have to roll
> its own check, to make sure it actually works widely on real systems.

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.

> Do you think it's worth supporting "equal?"?  It is slightly more
> complicated to implement (it's hard to beat "eq?").  However, it would
> be much more general, e.g., it'd allow the use of ,op.

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

> > 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 (which, by
the way, is not part of Posix, though quite pervasive in everything but

> > Of course you can argue that it's Gauche's responsibility to provide
> > a switch to non-standard syntax, e.g. #!gauche-curly-syntax, which
> > is reasonable.
> That's exactly what I'll argue.  If there's a way we can simplify
> transition, though, I'd love to hear it.

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

Why are well-meaning Westerners so concerned that   John Cowan
the opening of a Colonel Sanders in Beijing means   cowan@xxxxxxxx
the end of Chinese culture? [...]  We have had      http://www.ccil.org/~cowan
Chinese restaurants in America for over a century,
and it hasn't made us Chinese.  On the contrary,
we obliged the Chinese to invent chop suey.            --Marshall Sahlins