[r6rs-discuss] [scheme-reports] Scheme pattern matching & R*RS
kumoyuki at gmail.com
Sat Jan 22 02:21:47 EST 2011
On 22 January 2011 00:09, Andre van Tonder <andre at het.brown.edu> wrote:
> On Fri, 21 Jan 2011, David Rush wrote:
>> On 21 January 2011 14:57, John Cowan <cowan at mercury.ccil.org> wrote:
>>> David Rush scripsit:
>>>> Given the wide variety of things that get affected by pattern
>>>> matching, while I admit that this is possible, I don't think it is
>>>> advisable. Pattern matching is a powerfully expressive mechanism - if
>>>> we are going to have it we should properly percolate its power all the
>>>> way through the language.
>>> You are making the best the enemy of the good,
>> Yes I am, because once it gets out as a part of the standard, further
>> innovation and improvement will be jeopardized by the existence of
>> legacy code. This is a really big deal given how many issues in Scheme
>> currently exist precisely for backwards compatibility reasons.
> Putting it in the core would add enormous comlexity to core Scheme, which
> currently attracts many because of its simplicity. It would take several
> iterations of RnRSs to stabilize. It would also encourage a change in the
> style of Scheme to a kind of typeless ML in s-expressions. I do not see any
> pressing need for it.
Hmmm...well I do, although I admit my ambivalence about trying to
develop it by standardization. Tightly-integrated, user-defined
algebraic types give rise to pattern matching pretty much immediately,
unless you happen to be a big fan of writing manual dispatch
> It seems to go against the founding moral principles
> of Scheme.
What? It's a single unifying mechanism for type-dispatch. It allows
unification of call/return without resorting to CALL-WITH-VALUES. If
there's any language idea out in the wild that Scheme *hasn't" got
already that fits the Clinger criterion more than pattern matching,
I'd seriously like to know what it is. And no modules don't really
count, because LAMBDA really is enough (even though i have agreed to
the charter issues around this).
> We have had pattern matchers for decades, but for some reason very few
> Scheme programmers use pattern matching much. Does that tell us something?
Yes it does. It tells us that, given the state of Scheme's type
system, bolt-on pattern match syntax using s-expressions mostly sucks.
And I agree with that point. In fact in a recent private discussion,
the point was made to me that in terms of expressivity, s-expressions
suck in inverse proportion to the complexity of the structure being
describe by them. Which makes a lot of sense out of several phenomena
we've seen over the years:
* Scsh's SREs never caught on
* type annotations for sexp languages have never caught on
* pattern match has never caught on
All of these amount to tiny languages which are very informationally
dense. S-exps are *not* dense, however they are structurally very
clear - which makes for a certain impedance mismatch between feature
semantic and surface syntax.
As should be obvious, I am somewhat ambivalent on the topic of pattern
matching; however I oppose a half-baked bolt-on approach that is meant
to look like it might be native. If its going to be done it should be
done right - and frankly that might mean a language which would still
be very much in the Scheme family, but I expect would be different
from current RnRS in any number of large and small ways.
GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt
More information about the r6rs-discuss