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

Re: [Scheme-reports] [r6rs-discuss] [scheme-reports] Scheme pattern matching & R*RS

Peter Kourzanov <peter.kourzanov@x> writes:

> Jim,
> I would like to know why (case) is excluded from this proposal.

I did not include case for two reasons:

a.) existing match libraries do not have an analogue of case

b.) RNRS case's syntax does not lend itself to extending to the pattern
    matching case in an upwardly compatible manner.  In particular, case
    compares values with eqv? and performs no binding, while lambda and
    the let forms are all binding forms (and compare with equal? in the
    pattern-matching versions).

    This means that making case destructure its arguments would change
    the meaning of existing valid code, at least for non-list,
    non-vector patterns:

               (case 'a
                 ((a) (list a))
                 (else #f))

               ==> (3)

Neither of these is necessarily compelling, but I think both argue that
adding pattern matching support to case is more intrusive than adding it
only to the environment-constructing forms.  On the other hand, the
(match ...) form of (rnrs match) can be used in a manner similar to
(case ...), but with no compatibility concerns for existing code.

				Jim Wise

Attachment: pgppkT7pgB2B8.pgp
Description: PGP signature

Scheme-reports mailing list